f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl
authorDaeho Jeong <daehojeong@google.com>
Tue, 21 Jul 2020 03:21:11 +0000 (12:21 +0900)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 21 Jul 2020 19:58:11 +0000 (12:58 -0700)
commit9af846486d781a63de025a5f502c515268e48790
tree62787872c556bba780a03fa6a724ff4b6650f21b
parentb0f3b87fb3abc42c81d76c6c5795f26dbdb2f04b
f2fs: add F2FS_IOC_SEC_TRIM_FILE ioctl

Added a new ioctl to send discard commands or/and zero out
to selected data area of a regular file for security reason.

The way of handling range.len of F2FS_IOC_SEC_TRIM_FILE:
1. Added -1 value support for range.len to secure trim the whole blocks
   starting from range.start regardless of i_size.
2. If the end of the range passes over the end of file, it means until
   the end of file (i_size).
3. ignored the case of that range.len is zero to prevent the function
   from making end_addr zero and triggering different behaviour of
   the function.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
fs/f2fs/file.c