f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl
PATCH v5 1/1 f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl
From: Daeho Jeong <[email protected]>
Added a new ioctl to send discard commands or/and zero out to selected data area of a regular file for security reason.
Signed-off-by Daeho Jeong <[email protected]>
Reviewed-by Chao Yu <[email protected]>
Signed-off-by Jaegeuk Kim <[email protected]>
--- fs/f2fs/f2fs.h | 15 ++++ fs/f2fs/file.c | 181 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+)
fs/f2fs/f2fs.h +15 -0
@@ -434,6 +434,8 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal, _IOR(F2FS_IOCTL_MAGIC, 18, __u64)#define F2FS_IOC_RESERVE_COMPRESS_BLOCKS \ _IOR(F2FS_IOCTL_MAGIC, 19, __u64) +#define F2FS_IOC_SEC_TRIM_FILE _IOW(F2FS_IOCTL_MAGIC, 20, \ + struct f2fs_sectrim_range)#define F2FS_IOC_GET_VOLUME_NAME FS_IOC_GETFSLABEL#define F2FS_IOC_SET_VOLUME_NAME FS_IOC_SETFSLABEL
@@ -453,6 +455,13 @@ static inline bool __has_cursum_space(struct f2fs_journal *journal,#define F2FS_GOING_DOWN_METAFLUSH 0x3/* going down with meta flush */ #define F2FS_GOING_DOWN_NEED_FSCK 0x4/* going down to trigger fsck */ +/* +* Flags used by F2FS_IOC_SEC_TRIM_FILE +*/ +#define F2FS_TRIM_FILE_DISCARD 0x1/* send discard command */ +#define F2FS_TRIM_FILE_ZEROOUT 0x2/* zero out */ +#define F2FS_TRIM_FILE_MASK 0x3 +#if defined(__KERNEL__) && defined(CONFIG_COMPAT )/* * ioctl commands in 32 bit emulation
@@ -488,6 +497,12 @@ struct f2fs_flush_device {u32 segments;/* # of segments to flush */ }; +struct f2fs_sectrim_range { +u64 start; +u64 len; +u64 flags; +}; +/* for inline stuff */ #define DEF_INLINE_RESERVED_SIZE 1static inline int get_extra_isize (struct inode *inode);
fs/f2fs/file.c +181 -0
205 lines not on this page · raw message
Signature · 1 line
2.27.0.383.g050319c2ae-goog