Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1491639

Re: [PATCH 1/2] f2fs: fix to commit bio cache after flushing node pages

From Jaegeuk Kim <jaegeuk@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] f2fs: fix to commit bio cache after flushing node pages
Date 2016-09-27 03:40 +0200
Message-ID <slPxf-34m-1@gated-at.bofh.it> (permalink)
References <slGNk-64r-7@gated-at.bofh.it> <slIYN-7lv-1@gated-at.bofh.it> <slOUx-2w5-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Sep 27, 2016 at 08:57:41AM +0800, Chao Yu wrote:
> Hi Jaegeuk,
> 
> On 2016/9/27 2:33, Jaegeuk Kim wrote:
> > Hi Chao,
> > 
> > On Tue, Sep 27, 2016 at 12:09:52AM +0800, Chao Yu wrote:
> >> From: Chao Yu <yuchao0@huawei.com>
> >>
> >> In sync_node_pages, we won't check and commit last merged pages in private
> >> bio cache of f2fs, as these pages were taged as writeback, someone who is
> >> waiting for writebacking of the page will be blocked until the cache was
> >> committed by someone else.
> >>
> >> We need to commit node type bio cache to avoid potential deadlock or long
> >> delay of waiting writeback.
> >>
> >> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> >> ---
> >>  fs/f2fs/node.c | 11 +++++++++--
> >>  1 file changed, 9 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
> >> index 9faddcd..f73f774 100644
> >> --- a/fs/f2fs/node.c
> >> +++ b/fs/f2fs/node.c
> >> @@ -1416,6 +1416,7 @@ int sync_node_pages(struct f2fs_sb_info *sbi, struct writeback_control *wbc)
> >>  	struct pagevec pvec;
> >>  	int step = 0;
> >>  	int nwritten = 0;
> >> +	int ret = 0;
> >>  
> >>  	pagevec_init(&pvec, 0);
> >>  
> >> @@ -1436,7 +1437,8 @@ next_step:
> >>  
> >>  			if (unlikely(f2fs_cp_error(sbi))) {
> >>  				pagevec_release(&pvec);
> >> -				return -EIO;
> >> +				ret = -EIO;
> >> +				goto out;
> >>  			}
> >>  
> >>  			/*
> >> @@ -1487,6 +1489,8 @@ continue_unlock:
> >>  
> >>  			if (NODE_MAPPING(sbi)->a_ops->writepage(page, wbc))
> >>  				unlock_page(page);
> >> +			else
> >> +				nwritten++;
> >>  
> >>  			if (--wbc->nr_to_write == 0)
> >>  				break;
> >> @@ -1504,7 +1508,10 @@ continue_unlock:
> >>  		step++;
> >>  		goto next_step;
> >>  	}
> >> -	return nwritten;
> >> +out:
> >> +	if (nwritten)
> >> +		f2fs_submit_merged_bio(sbi, NODE, WRITE);
> > 
> > IIRC, we don't need to flush this, since f2fs_submit_merged_bio_cond() would
> > handle this in f2fs_wait_on_page_writeback().
> 
> Yes, it covers all the cases in f2fs private codes, but there are still some
> codes in mm or fs directory, and they didn't use f2fs_wait_on_page_writeback
> when waiting page writeback. Such as do_writepages && filemap_fdatawait in
> __writeback_single_inode...

The do_writepages() is okay, which will call f2fs_write_node_pages().
The __writeback_single_inode() won't do filemap_fdatawait() with WB_SYNC_ALL.
We don't need to take care of truncation as well.

Any missing one?

> 
> Thanks,
> 
> > 
> > Thanks,
> > 
> >> +	return ret;
> >>  }
> >>  
> >>  int wait_on_node_pages_writeback(struct f2fs_sb_info *sbi, nid_t ino)
> >> -- 
> >> 2.7.2
> > 
> > .
> > 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] f2fs: fix to commit bio cache after flushing node pages Chao Yu <chao@kernel.org> - 2016-09-26 18:20 +0200
  Re: [PATCH 1/2] f2fs: fix to commit bio cache after flushing node  pages Jaegeuk Kim <jaegeuk@kernel.org> - 2016-09-26 20:40 +0200
    Re: [PATCH 1/2] f2fs: fix to commit bio cache after flushing node  pages Chao Yu <yuchao0@huawei.com> - 2016-09-27 03:00 +0200
      Re: [PATCH 1/2] f2fs: fix to commit bio cache after flushing node  pages Jaegeuk Kim <jaegeuk@kernel.org> - 2016-09-27 03:40 +0200
        Re: [PATCH 1/2] f2fs: fix to commit bio cache after flushing node  pages Chao Yu <yuchao0@huawei.com> - 2016-09-27 04:10 +0200
          Re: [PATCH 1/2] f2fs: fix to commit bio cache after flushing node  pages Jaegeuk Kim <jaegeuk@kernel.org> - 2016-09-28 22:20 +0200
            Re: [PATCH 1/2] f2fs: fix to commit bio cache after flushing node  pages Chao Yu <yuchao0@huawei.com> - 2016-09-29 12:50 +0200
              Re: [PATCH 1/2] f2fs: fix to commit bio cache after flushing node  pages Jaegeuk Kim <jaegeuk@kernel.org> - 2016-09-30 01:50 +0200

csiph-web