From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751746AbdJPDLl (ORCPT ); Sun, 15 Oct 2017 23:11:41 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:8453 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751461AbdJPDLj (ORCPT ); Sun, 15 Oct 2017 23:11:39 -0400 Subject: Re: [PATCH] f2fs: expose some sectors to user in inline data or dentry case To: Jaegeuk Kim , , , References: <20171013173145.36510-1-jaegeuk@kernel.org> From: Chao Yu Message-ID: <6ecc1778-bcf8-c07d-037a-dd733e247fa9@huawei.com> Date: Mon, 16 Oct 2017 11:11:28 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20171013173145.36510-1-jaegeuk@kernel.org> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020204.59E42366.004F,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: e9afc9fd09b3c8889a78877e295479a7 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2017/10/14 1:31, Jaegeuk Kim wrote: > If there's some data written through inline data or dentry, we need to shouw > st_blocks. This fixes reporting zero blocks even though there is small written > data. > > Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu Thanks, > --- > fs/f2fs/file.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c > index 2eb3efe92018..f7be6c394fa8 100644 > --- a/fs/f2fs/file.c > +++ b/fs/f2fs/file.c > @@ -698,6 +698,11 @@ int f2fs_getattr(const struct path *path, struct kstat *stat, > STATX_ATTR_NODUMP); > > generic_fillattr(inode, stat); > + > + /* we need to show initial sectors used for inline_data/dentries */ > + if (f2fs_has_inline_data(inode) || f2fs_has_inline_dentry(inode)) > + stat->blocks += (stat->size + 511) >> 9; > + > return 0; > } > >