From: Sheng Yong Subject: Re: [RFC PATCH 6/8] fsck.f2fs: introduce new option --dry-run Date: Tue, 31 Oct 2017 17:19:40 +0800 Message-ID: <856efe58-e45a-ee50-6227-c4a8c25405a8@huawei.com> References: <20171031013824.46544-1-shengyong1@huawei.com> <20171031013824.46544-6-shengyong1@huawei.com> <9ebcb886-ae85-6cb0-2a61-df3d2a585df1@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.89) (envelope-from ) id 1e9Ske-0003WD-Vb for linux-f2fs-devel@lists.sourceforge.net; Tue, 31 Oct 2017 09:22:28 +0000 Received: from [45.249.212.32] (helo=huawei.com) by sog-mx-4.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1e9Skd-0001tO-1d for linux-f2fs-devel@lists.sourceforge.net; Tue, 31 Oct 2017 09:22:28 +0000 In-Reply-To: <9ebcb886-ae85-6cb0-2a61-df3d2a585df1@huawei.com> Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Chao Yu , jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net 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 >> --- >> 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