From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <yuchao0@huawei.com>
Cc: heyunlei@huwei.com, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 2/2 v2] f2fs: add a case of no need to read a page in write begin
Date: Wed, 21 Dec 2016 09:58:00 -0800 [thread overview]
Message-ID: <20161221175800.GA1361@jaegeuk.local> (raw)
In-Reply-To: <6474af05-f3ed-036d-485b-316bb8407991@huawei.com>
On 12/21, Chao Yu wrote:
> On 2016/12/21 2:03, Jaegeuk Kim wrote:
> > On 12/20, Yunlei He wrote:
> >> If the range we write cover the whole valid data in the last page,
> >> we do not need to read it.
> >>
> >> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> >> ---
> >> fs/f2fs/data.c | 5 ++++-
> >> 1 file changed, 4 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> >> index 9ac2625..303873f 100644
> >> --- a/fs/f2fs/data.c
> >> +++ b/fs/f2fs/data.c
> >> @@ -1715,6 +1715,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
> >> if (len == PAGE_SIZE || PageUptodate(page))
> >> return 0;
> >>
> >> + if (!(pos & (PAGE_SIZE - 1)) && (pos + len) >= i_size_read(inode))
> >
> > I added here:
> > zero_user_segment(page, 0, PAGE_SIZE);
>
> Only need to zeroout in range of [len, page_size] in the page.
Yup, fixed.
Thanks,
>
> Thanks,
>
> >
> > Otherwise, xfstests/f2fs/001 gives a failure.
> >
> > Thanks,
> >
> >> + return 0;
> >> +
> >> if (blkaddr == NEW_ADDR) {
> >> zero_user_segment(page, 0, PAGE_SIZE);
> >> SetPageUptodate(page);
> >> @@ -1768,7 +1771,7 @@ static int f2fs_write_end(struct file *file,
> >> * let generic_perform_write() try to copy data again through copied=0.
> >> */
> >> if (!PageUptodate(page)) {
> >> - if (unlikely(copied != PAGE_SIZE))
> >> + if (unlikely(copied != len))
> >> copied = 0;
> >> else
> >> SetPageUptodate(page);
> >> --
> >> 2.10.1
> >>
> >>
> >> ------------------------------------------------------------------------------
> >> Developer Access Program for Intel Xeon Phi Processors
> >> Access to Intel Xeon Phi processor-based developer platforms.
> >> With one year of Intel Parallel Studio XE.
> >> Training and support from Colfax.
> >> Order your platform today.http://sdm.link/intel
> >> _______________________________________________
> >> Linux-f2fs-devel mailing list
> >> Linux-f2fs-devel@lists.sourceforge.net
> >> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> >
> > .
> >
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today.http://sdm.link/intel
next prev parent reply other threads:[~2016-12-21 17:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-20 3:11 [PATCH 1/2 v2] f2fs: fix a missing discard prefree segments Yunlei He
2016-12-20 3:11 ` [PATCH 2/2 v2] f2fs: add a case of no need to read a page in write begin Yunlei He
2016-12-20 18:03 ` Jaegeuk Kim
2016-12-21 1:28 ` Chao Yu
2016-12-21 17:58 ` Jaegeuk Kim [this message]
2016-12-21 2:02 ` [PATCH 1/2 v2] f2fs: fix a missing discard prefree segments Chao Yu
2016-12-21 2:27 ` Chao Yu
2016-12-21 3:35 ` heyunlei
2016-12-21 3:55 ` Chao Yu
2016-12-21 9:00 ` heyunlei
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161221175800.GA1361@jaegeuk.local \
--to=jaegeuk@kernel.org \
--cc=heyunlei@huwei.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=yuchao0@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).