OSDN Git Service

secdiscard: use F2FS_IOC_SEC_TRIM_FILE for secure discard
authorDaeho Jeong <daehojeong@google.com>
Tue, 8 Sep 2020 03:59:28 +0000 (12:59 +0900)
committerDaeho Jeong <daehojeong@google.com>
Sun, 13 Sep 2020 23:43:15 +0000 (08:43 +0900)
commitd1b946ea9fa904b5b89bf25633d62fc468bd2c00
tree7de3ff987af92af30393edded4e8e925edda3791
parent3d1b6ac7c09fd07e19cac4ba9d8660f0cc5add60
secdiscard: use F2FS_IOC_SEC_TRIM_FILE for secure discard

A new interface, F2FS_IOC_SEC_TRIM_FILE, has been added to F2FS
filesystem to send secure discard command to a specific file,
not to block device. We can use this interface for better discard
command handling on a file basis.

[how to use F2FS_IOC_SEC_TRIM_FILE]
start: start offset in byte (should be aligned with 4096)
len: length in byte (should be aligned with 4096, except designating EOF)
     -1 also means till EOF.
flags: F2FS_TRIM_FILE_DISCARD - sending secure discard command. If the
                                device doesn't support it, send normal
                                discard.
       F2FS_TRIM_FILE_ZEROOUT - overwrite zero data in the file.

Bug: 140759142
Test: execute "secdiscard -- <file_path>" and check the content of file
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Change-Id: I6ee44a047d291274c9d70ae5e4ccccfc06a52f89
secdiscard.cpp