mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Remove O_SYNC from device open and use fsync().
This speed up wipe operation considerably.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user