Skip to content

Commit 562b7cf

Browse files
IDE write-through with configurable property.
Co-authored-by: LSantha <LSantha@users.noreply.github.com>
1 parent 7baa16d commit 562b7cf

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

fs/src/driver/org/jnode/driver/block/ide/disk/IDEDiskDriver.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
import org.jnode.partitions.ibm.IBMPartitionTable;
5454
import org.jnode.partitions.ibm.IBMPartitionTableEntry;
5555
import org.jnode.util.TimeoutException;
56+
import org.jnode.vm.VmIOContext;
5657

5758
/**
5859
* Device driver for IDE disks.
@@ -84,6 +85,7 @@ public class IDEDiskDriver extends Driver
8485
private boolean is48bit;
8586
private IDEDiskBus diskBus;
8687
private IBMPartitionTable pt;
88+
private boolean writeThrough = true;
8789

8890
protected void startDevice() throws DriverException {
8991
final IDEDevice dev = (IDEDevice) getDevice();
@@ -99,6 +101,9 @@ protected void startDevice() throws DriverException {
99101
is48bit = descr.supports48bitAddressing();
100102
maxSector = descr.getSectorsAddressable();
101103

104+
writeThrough = !"false".equals(
105+
VmIOContext.getGlobalProperties().getProperty("jnode.ide.writethrough"));
106+
102107
// Look for partitions
103108
try {
104109
// Find the devicemanager
@@ -269,6 +274,10 @@ protected void transfer(long devOffset, ByteBuffer buf, boolean isWrite) throws
269274
length -= partLength;
270275
devOffset += partLength;
271276
}
277+
278+
if (isWrite && writeThrough) {
279+
flush();
280+
}
272281
}
273282

274283
static class IDEDiskBus extends Bus {

0 commit comments

Comments
 (0)