On 2017/10/31 15:57, Chao Yu wrote:
On 2017/10/31 9:38, Sheng Yong wrote:
With --dry-run enabled, fsck.f2fs will do all checks and "fixes" except
that all fixes will not be written to storage at last.

Signed-off-by: Sheng Yong <shengyo...@huawei.com>
---
  fsck/main.c       | 14 +++++++++++++-
  include/f2fs_fs.h |  1 +
  lib/libf2fs.c     |  1 +
  lib/libf2fs_io.c  |  3 +++
  4 files changed, 18 insertions(+), 1 deletion(-)

[...]
  static int is_mounted(const char *mpt, const char *device)
diff --git a/lib/libf2fs_io.c b/lib/libf2fs_io.c
index 50ff171..8a79672 100644
--- a/lib/libf2fs_io.c
+++ b/lib/libf2fs_io.c
@@ -129,6 +129,9 @@ int dev_write(void *buf, __u64 offset, size_t len)
  {
        int fd;
+ if (c.dry_run)
+               return 0;
+
        if (c.sparse_mode)
                return dev_write_sparse(buf, offset, len);

Do we need to cover dev_write_block?
dev_write_block calls dev_write. So dev_write_block is also covered by 
intercepting
write in dev_write. :)

Thanks,
Sheng

Thanks,



.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to