linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] f2fs: cover number of dirty node pages under node_write lock
@ 2015-09-15 16:55 Jaegeuk Kim
  2015-09-15 16:55 ` [PATCH 2/2] f2fs: no need to lock for update_inode_page all the time Jaegeuk Kim
  2015-09-17 11:43 ` [f2fs-dev] [PATCH 1/2] f2fs: cover number of dirty node pages under node_write lock Chao Yu
  0 siblings, 2 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2015-09-15 16:55 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

This number is referenced by checkpoint under node_write lock.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/node.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 27d1a74..4d9bedf 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1323,23 +1323,24 @@ static int f2fs_write_node_page(struct page *page,
 	nid = nid_of_node(page);
 	f2fs_bug_on(sbi, page->index != nid);
 
+	if (wbc->for_reclaim) {
+		if (!down_read_trylock(&sbi->node_write))
+			goto redirty_out;
+	} else {
+		down_read(&sbi->node_write);
+	}
+
 	get_node_info(sbi, nid, &ni);
 
 	/* This page is already truncated */
 	if (unlikely(ni.blk_addr == NULL_ADDR)) {
 		ClearPageUptodate(page);
 		dec_page_count(sbi, F2FS_DIRTY_NODES);
+		up_read(&sbi->node_write);
 		unlock_page(page);
 		return 0;
 	}
 
-	if (wbc->for_reclaim) {
-		if (!down_read_trylock(&sbi->node_write))
-			goto redirty_out;
-	} else {
-		down_read(&sbi->node_write);
-	}
-
 	set_page_writeback(page);
 	fio.blk_addr = ni.blk_addr;
 	write_node_page(nid, &fio);
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] f2fs: no need to lock for update_inode_page all the time
  2015-09-15 16:55 [PATCH 1/2] f2fs: cover number of dirty node pages under node_write lock Jaegeuk Kim
@ 2015-09-15 16:55 ` Jaegeuk Kim
  2015-09-17 12:19   ` [f2fs-dev] " Chao Yu
  2015-09-17 11:43 ` [f2fs-dev] [PATCH 1/2] f2fs: cover number of dirty node pages under node_write lock Chao Yu
  1 sibling, 1 reply; 5+ messages in thread
From: Jaegeuk Kim @ 2015-09-15 16:55 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, linux-f2fs-devel; +Cc: Jaegeuk Kim

As comment says, we don't need to call f2fs_lock_op in write_inode to prevent
from producing dirty node pages all the time.
That happens only when there is not enough free sections and we can avoid that
by calling balance_fs in prior to that.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/inode.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
index 35aae65..0fc4d02 100644
--- a/fs/f2fs/inode.c
+++ b/fs/f2fs/inode.c
@@ -296,16 +296,12 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
 		return 0;
 
 	/*
-	 * We need to lock here to prevent from producing dirty node pages
+	 * We need to balance fs here to prevent from producing dirty node pages
 	 * during the urgent cleaning time when runing out of free sections.
 	 */
-	f2fs_lock_op(sbi);
-	update_inode_page(inode);
-	f2fs_unlock_op(sbi);
-
-	if (wbc)
-		f2fs_balance_fs(sbi);
+	f2fs_balance_fs(sbi);
 
+	update_inode_page(inode);
 	return 0;
 }
 
-- 
2.1.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [f2fs-dev] [PATCH 1/2] f2fs: cover number of dirty node pages under node_write lock
  2015-09-15 16:55 [PATCH 1/2] f2fs: cover number of dirty node pages under node_write lock Jaegeuk Kim
  2015-09-15 16:55 ` [PATCH 2/2] f2fs: no need to lock for update_inode_page all the time Jaegeuk Kim
@ 2015-09-17 11:43 ` Chao Yu
  1 sibling, 0 replies; 5+ messages in thread
From: Chao Yu @ 2015-09-17 11:43 UTC (permalink / raw)
  To: 'Jaegeuk Kim'; +Cc: linux-f2fs-devel, linux-fsdevel, linux-kernel

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Wednesday, September 16, 2015 12:56 AM
> To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 1/2] f2fs: cover number of dirty node pages under node_write lock
> 
> This number is referenced by checkpoint under node_write lock.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

Reviewed-by: Chao Yu <chao2.yu@samsung.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [f2fs-dev] [PATCH 2/2] f2fs: no need to lock for update_inode_page all the time
  2015-09-15 16:55 ` [PATCH 2/2] f2fs: no need to lock for update_inode_page all the time Jaegeuk Kim
@ 2015-09-17 12:19   ` Chao Yu
  2015-09-17 18:00     ` Jaegeuk Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Chao Yu @ 2015-09-17 12:19 UTC (permalink / raw)
  To: 'Jaegeuk Kim'; +Cc: linux-kernel, linux-fsdevel, linux-f2fs-devel

Hi Jaegeuk,

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Wednesday, September 16, 2015 12:56 AM
> To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> linux-f2fs-devel@lists.sourceforge.net
> Cc: Jaegeuk Kim
> Subject: [f2fs-dev] [PATCH 2/2] f2fs: no need to lock for update_inode_page all the time
> 
> As comment says, we don't need to call f2fs_lock_op in write_inode to prevent
> from producing dirty node pages all the time.
> That happens only when there is not enough free sections and we can avoid that
> by calling balance_fs in prior to that.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>  fs/f2fs/inode.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> index 35aae65..0fc4d02 100644
> --- a/fs/f2fs/inode.c
> +++ b/fs/f2fs/inode.c
> @@ -296,16 +296,12 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
>  		return 0;
> 
>  	/*
> -	 * We need to lock here to prevent from producing dirty node pages
> +	 * We need to balance fs here to prevent from producing dirty node pages
>  	 * during the urgent cleaning time when runing out of free sections.
>  	 */
> -	f2fs_lock_op(sbi);
> -	update_inode_page(inode);
> -	f2fs_unlock_op(sbi);
> -
> -	if (wbc)
> -		f2fs_balance_fs(sbi);

f2fs_balance_fs was moved here intentionally by Jin Xu in commit 92c4342fb72a
("f2fs: avoid writing inode redundantly when creating a file") to avoid
redundantly inode page submitting, I was confused since I didn't know all
history here. So, should we change the position of f2fs_balance_fs?

Thanks,

> +	f2fs_balance_fs(sbi);
> 
> +	update_inode_page(inode);
>  	return 0;
>  }
> 
> --
> 2.1.1
> 
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [f2fs-dev] [PATCH 2/2] f2fs: no need to lock for update_inode_page all the time
  2015-09-17 12:19   ` [f2fs-dev] " Chao Yu
@ 2015-09-17 18:00     ` Jaegeuk Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Jaegeuk Kim @ 2015-09-17 18:00 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-fsdevel, linux-f2fs-devel

On Thu, Sep 17, 2015 at 08:19:06PM +0800, Chao Yu wrote:
> Hi Jaegeuk,
> 
> > -----Original Message-----
> > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> > Sent: Wednesday, September 16, 2015 12:56 AM
> > To: linux-kernel@vger.kernel.org; linux-fsdevel@vger.kernel.org;
> > linux-f2fs-devel@lists.sourceforge.net
> > Cc: Jaegeuk Kim
> > Subject: [f2fs-dev] [PATCH 2/2] f2fs: no need to lock for update_inode_page all the time
> > 
> > As comment says, we don't need to call f2fs_lock_op in write_inode to prevent
> > from producing dirty node pages all the time.
> > That happens only when there is not enough free sections and we can avoid that
> > by calling balance_fs in prior to that.
> > 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >  fs/f2fs/inode.c | 10 +++-------
> >  1 file changed, 3 insertions(+), 7 deletions(-)
> > 
> > diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> > index 35aae65..0fc4d02 100644
> > --- a/fs/f2fs/inode.c
> > +++ b/fs/f2fs/inode.c
> > @@ -296,16 +296,12 @@ int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc)
> >  		return 0;
> > 
> >  	/*
> > -	 * We need to lock here to prevent from producing dirty node pages
> > +	 * We need to balance fs here to prevent from producing dirty node pages
> >  	 * during the urgent cleaning time when runing out of free sections.
> >  	 */
> > -	f2fs_lock_op(sbi);
> > -	update_inode_page(inode);
> > -	f2fs_unlock_op(sbi);
> > -
> > -	if (wbc)
> > -		f2fs_balance_fs(sbi);
> 
> f2fs_balance_fs was moved here intentionally by Jin Xu in commit 92c4342fb72a
> ("f2fs: avoid writing inode redundantly when creating a file") to avoid
> redundantly inode page submitting, I was confused since I didn't know all
> history here. So, should we change the position of f2fs_balance_fs?

Oh, I remained that order. Fixed and merged.

Thanks,

> 
> Thanks,
> 
> > +	f2fs_balance_fs(sbi);
> > 
> > +	update_inode_page(inode);
> >  	return 0;
> >  }
> > 
> > --
> > 2.1.1
> > 
> > 
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-17 18:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-15 16:55 [PATCH 1/2] f2fs: cover number of dirty node pages under node_write lock Jaegeuk Kim
2015-09-15 16:55 ` [PATCH 2/2] f2fs: no need to lock for update_inode_page all the time Jaegeuk Kim
2015-09-17 12:19   ` [f2fs-dev] " Chao Yu
2015-09-17 18:00     ` Jaegeuk Kim
2015-09-17 11:43 ` [f2fs-dev] [PATCH 1/2] f2fs: cover number of dirty node pages under node_write lock Chao Yu

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).