All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fengguang Wu <fengguang.wu@intel.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 3/4] writeback: Refactor writeback_single_inode()
Date: Mon, 19 Mar 2012 13:07:28 +0800	[thread overview]
Message-ID: <20120319050728.GA5191@localhost> (raw)
In-Reply-To: <1331283748-12959-4-git-send-email-jack@suse.cz>

On Fri, Mar 09, 2012 at 10:02:27AM +0100, Jan Kara wrote:
> The code in writeback_single_inode() is relatively complex. The list
> requeing logic makes sense only for flusher thread but not really for
> sync_inode() or write_inode_now() callers. Also when we want to get
> rid of inode references held by flusher thread, we will need a special
> I_SYNC handling there.
> 
> So separate part of writeback_single_inode() which does the real writeback work
> into __writeback_single_inode(). Make writeback_single_inode() do only stuff
> necessary for callers writing only one inode, and move the special list
> handling into writeback_sb_inodes() and a helper function inode_wb_requeue().
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/fs-writeback.c                |  264 +++++++++++++++++++++-----------------
>  include/trace/events/writeback.h |   36 ++++-
>  2 files changed, 174 insertions(+), 126 deletions(-)
> 
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c

> +
> +	ret = __writeback_single_inode(inode, wb, wbc);
> +
> +	spin_lock(&wb->list_lock);
> +	spin_lock(&inode->i_lock);
> +	if (inode->i_state & I_FREEING)
> +		goto out_unlock;
> +	if (inode->i_state & I_DIRTY)
> +		redirty_tail(inode, wb);
> +	else
> +		list_del_init(&inode->i_wb_list);

It seems that the above redirty_tail() and hence I_FREEING check can
be eliminated? writeback_single_inode() does not need to deal with wb
list requeue now, but only need to care about dequeue.

The patch looks fine otherwise.

> +out_unlock:
>  	inode_sync_complete(inode);
> -	trace_writeback_single_inode(inode, wbc, nr_to_write);
> +	spin_unlock(&inode->i_lock);
> +	spin_unlock(&wb->list_lock);
> +
>  	return ret;
>  }
>  

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Fengguang Wu <fengguang.wu@intel.com>
To: Jan Kara <jack@suse.cz>
Cc: linux-fsdevel@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 3/4] writeback: Refactor writeback_single_inode()
Date: Mon, 19 Mar 2012 13:07:28 +0800	[thread overview]
Message-ID: <20120319050728.GA5191@localhost> (raw)
In-Reply-To: <1331283748-12959-4-git-send-email-jack@suse.cz>

On Fri, Mar 09, 2012 at 10:02:27AM +0100, Jan Kara wrote:
> The code in writeback_single_inode() is relatively complex. The list
> requeing logic makes sense only for flusher thread but not really for
> sync_inode() or write_inode_now() callers. Also when we want to get
> rid of inode references held by flusher thread, we will need a special
> I_SYNC handling there.
> 
> So separate part of writeback_single_inode() which does the real writeback work
> into __writeback_single_inode(). Make writeback_single_inode() do only stuff
> necessary for callers writing only one inode, and move the special list
> handling into writeback_sb_inodes() and a helper function inode_wb_requeue().
> 
> Signed-off-by: Jan Kara <jack@suse.cz>
> ---
>  fs/fs-writeback.c                |  264 +++++++++++++++++++++-----------------
>  include/trace/events/writeback.h |   36 ++++-
>  2 files changed, 174 insertions(+), 126 deletions(-)
> 
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c

> +
> +	ret = __writeback_single_inode(inode, wb, wbc);
> +
> +	spin_lock(&wb->list_lock);
> +	spin_lock(&inode->i_lock);
> +	if (inode->i_state & I_FREEING)
> +		goto out_unlock;
> +	if (inode->i_state & I_DIRTY)
> +		redirty_tail(inode, wb);
> +	else
> +		list_del_init(&inode->i_wb_list);

It seems that the above redirty_tail() and hence I_FREEING check can
be eliminated? writeback_single_inode() does not need to deal with wb
list requeue now, but only need to care about dequeue.

The patch looks fine otherwise.

> +out_unlock:
>  	inode_sync_complete(inode);
> -	trace_writeback_single_inode(inode, wbc, nr_to_write);
> +	spin_unlock(&inode->i_lock);
> +	spin_unlock(&wb->list_lock);
> +
>  	return ret;
>  }
>  

  reply	other threads:[~2012-03-19  5:07 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-09  9:02 [PATCH 0/4] Get rid of iput() from flusher thread Jan Kara
2012-03-09  9:02 ` Jan Kara
2012-03-09  9:02 ` [PATCH 1/4] fs: Remove bogus wait in write_inode_now() Jan Kara
2012-03-09  9:02   ` Jan Kara
2012-03-19  6:57   ` Christoph Hellwig
2012-03-19  6:57     ` Christoph Hellwig
2012-03-09  9:02 ` [PATCH 2/4] writeback: Remove outdated comment Jan Kara
2012-03-09  9:02   ` Jan Kara
2012-03-19  6:58   ` Christoph Hellwig
2012-03-19  6:58     ` Christoph Hellwig
2012-03-09  9:02 ` [PATCH 3/4] writeback: Refactor writeback_single_inode() Jan Kara
2012-03-09  9:02   ` Jan Kara
2012-03-19  5:07   ` Fengguang Wu [this message]
2012-03-19  5:07     ` Fengguang Wu
2012-03-19  7:13   ` Christoph Hellwig
2012-03-19  7:13     ` Christoph Hellwig
2012-03-19 16:16     ` Jan Kara
2012-03-19 16:16       ` Jan Kara
2012-03-09  9:02 ` [PATCH 4/4] writeback: Avoid iput() from flusher thread Jan Kara
2012-03-09  9:02   ` Jan Kara
2012-03-19  3:42   ` Fengguang Wu
2012-03-19  3:42     ` Fengguang Wu
2012-03-19  8:55   ` Christoph Hellwig
2012-03-19  8:55     ` Christoph Hellwig
2012-03-19 10:46     ` Jan Kara
2012-03-19 10:46       ` Jan Kara
2012-03-19 11:17       ` Fengguang Wu
2012-03-19 11:17         ` Fengguang Wu
2012-03-19  5:16 ` [PATCH 0/4] Get rid of " Fengguang Wu
2012-03-19  5:16   ` Fengguang Wu

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=20120319050728.GA5191@localhost \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.