ext2fs: don't retry discard/zeroout repeatedly
PATCH 1/1 ext2fs: don't retry discard/zeroout repeatedly
Call safe_getenv(UNIX_IO_NOZEROOUT) once when the device is opened and set CHANNEL_FLAG_NOZEROOUT if present instead of getting uid/euid/getenv every time unix_zeroout() is called.
For unix_discard() and unix_zeroout() don't continue to call them if the block device doesn't support these operations.
--- lib/ext2fs/ext2_io.h | 4 +++- lib/ext2fs/unix_io.c | 43 ++++++++++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 18 deletions(-)
lib/ext2fs/ext2_io.h +3 -1
@@ -34,6 +34,8 @@ typedef struct struct_io_stats *io_stats;#define CHANNEL_FLAGS_DISCARD_ZEROES 0x02#define CHANNEL_FLAGS_BLOCK_DEVICE 0x04#define CHANNEL_FLAGS_THREADS 0x08 +#define CHANNEL_FLAGS_NODISCARD 0x10 +#define CHANNEL_FLAGS_NOZEROOUT 0x20#define io_channel_discard_zeroes_data (i) (i->flags & CHANNEL_FLAGS_DISCARD_ZEROES)
@@ -57,7 +59,7 @@ struct struct_io_channel {int actual_bytes_written, errcode_t error);int refcount; -int flags; +unsigned int flags;long reserved[14 ];void *private_data;void *app_data;
lib/ext2fs/unix_io.c +26 -17
94 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Theodore Ts'o
AppliedQuoted 8 lines · Andreas Dilger
Call
safe_getenv(UNIX_IO_NOZEROOUT)once when the device is opened and setCHANNEL_FLAG_NOZEROOUTif present instead of getting uid/euid/getenv every timeunix_zeroout()is called.For
unix_discard()andunix_zeroout()don't continue to call them if the block device doesn't support these operations.[...]
Applied, thanks!
[1/1] ext2fs: don't retry discard/zeroout repeatedly
commit: cc20e3c4320ae34dd06ec4d6a71d07aa7d6599d7
Best regards,
Signature · 1 line
Theodore Ts'o <[email protected]>