Remove O_SYNC from device open and use fsync().

This speed up wipe operation considerably.
This commit is contained in:
Milan Broz
2018-08-09 12:01:20 +02:00
parent 5b5a64361f
commit 69a844c654
10 changed files with 29 additions and 5 deletions

View File

@@ -229,6 +229,16 @@ static int _open_locked(struct device *device, int flags)
return fd;
}
/*
* Common wrapper for device sync.
* FIXME: file descriptor will be in struct later.
*/
void device_sync(struct device *device, int devfd)
{
if (fsync(devfd) == -1)
log_dbg("Cannot sync device %s.", device_path(device));
}
/*
* in non-locked mode returns always fd or -1
*
@@ -242,7 +252,6 @@ static int device_open_internal(struct device *device, int flags)
{
int devfd;
flags |= O_SYNC;
if (device->o_direct)
flags |= O_DIRECT;