linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Chao Yu <chao2.yu@samsung.com>
To: 'Jaegeuk Kim' <jaegeuk.kim@samsung.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: RE: [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow
Date: Tue, 19 Nov 2013 13:25:57 +0800	[thread overview]
Message-ID: <001401cee4e8$09cf01b0$1d6d0510$@samsung.com> (raw)
In-Reply-To: <1384765922-24028-1-git-send-email-jaegeuk.kim@samsung.com>

Hi

> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk.kim@samsung.com]
> Sent: Monday, November 18, 2013 5:12 PM
> Cc: linux-fsdevel@vger.kernel.org; linux-kernel@vger.kernel.org; linux-f2fs-devel@lists.sourceforge.net
> Subject: [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow
> 
> This patch introduces PAGE_TYPE_OF_BIO() and cleans up do_submit_bio() with it.
> 
> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
> ---
>  fs/f2fs/f2fs.h    |  1 +
>  fs/f2fs/segment.c | 39 +++++++++++++++++++++------------------
>  2 files changed, 22 insertions(+), 18 deletions(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index fe5c2fc..1c783fd 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -351,6 +351,7 @@ enum count_type {
>   *			with waiting the bio's completion
>   * ...			Only can be used with META.
>   */
> +#define PAGE_TYPE_OF_BIO(type)	(type) > META ? META : (type)
>  enum page_type {
>  	DATA,
>  	NODE,
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 1f83999..dad5f1a 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -837,32 +837,35 @@ static void do_submit_bio(struct f2fs_sb_info *sbi,
>  				enum page_type type, bool sync)
>  {
>  	int rw = sync ? WRITE_SYNC : WRITE;
> -	enum page_type btype = type > META ? META : type;
> +	enum page_type btype = PAGE_TYPE_OF_BIO(type);

->f2fs_submit_bio()
	: enum page_type btype = PAGE_TYPE_OF_BIO(type);
	->do_submit_bio()
		: enum page_type btype = PAGE_TYPE_OF_BIO(type);

Could we remove PAGE_TYPE_OF_BIO or use f2fs_bug_on to instead
in do_submit_bio()? because it looks redundant , and also 
submit_write_page() will not pass the type which is larger than META.

> +	struct bio *bio = sbi->bio[btype];
> +	struct bio_private *p;
> +
> +	if (!bio)
> +		return;
> +
> +	sbi->bio[btype] = NULL;
> 
>  	if (type >= META_FLUSH)
>  		rw = WRITE_FLUSH_FUA;
> -
>  	if (btype == META)
>  		rw |= REQ_META;
> 
> -	if (sbi->bio[btype]) {
> -		struct bio_private *p = sbi->bio[btype]->bi_private;
> -		p->sbi = sbi;
> -		sbi->bio[btype]->bi_end_io = f2fs_end_io_write;
> +	p = bio->bi_private;
> +	p->sbi = sbi;
> +	bio->bi_end_io = f2fs_end_io_write;
> 
> -		trace_f2fs_do_submit_bio(sbi->sb, btype, sync, sbi->bio[btype]);
> +	trace_f2fs_do_submit_bio(sbi->sb, btype, sync, bio);
> 
> -		if (type == META_FLUSH) {
> -			DECLARE_COMPLETION_ONSTACK(wait);
> -			p->is_sync = true;
> -			p->wait = &wait;
> -			submit_bio(rw, sbi->bio[btype]);
> -			wait_for_completion(&wait);
> -		} else {
> -			p->is_sync = false;
> -			submit_bio(rw, sbi->bio[btype]);
> -		}
> -		sbi->bio[btype] = NULL;
> +	if (type == META_FLUSH) {
> +		DECLARE_COMPLETION_ONSTACK(wait);
> +		p->is_sync = true;
> +		p->wait = &wait;
> +		submit_bio(rw, bio);
> +		wait_for_completion(&wait);
> +	} else {
> +		p->is_sync = false;
> +		submit_bio(rw, bio);
>  	}
>  }
> 
> --
> 1.8.4.474.g128a96c
> 
> 
> ------------------------------------------------------------------------------
> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
> Free app hosting. Or install the open source package on any LAMP server.
> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  parent reply	other threads:[~2013-11-19  5:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-18  9:12 [PATCH 1/2] f2fs: clean up the do_submit_bio flow Jaegeuk Kim
2013-11-18  9:12 ` [PATCH 2/2] f2fs: use sbi->wr_mutex for write bios Jaegeuk Kim
2013-11-18  9:21   ` Gu Zheng
2013-11-18  9:30     ` Jaegeuk Kim
2013-11-19  0:39 ` [f2fs-dev] [PATCH 1/2] f2fs: clean up the do_submit_bio flow Chao Yu
2013-11-19  5:25 ` Chao Yu [this message]
2013-11-19  6:33   ` Jaegeuk Kim

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='001401cee4e8$09cf01b0$1d6d0510$@samsung.com' \
    --to=chao2.yu@samsung.com \
    --cc=jaegeuk.kim@samsung.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 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).