All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
To: Chao Yu <chao2.yu@samsung.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/2] f2fs: add a new function to support for merging contiguous read
Date: Wed, 13 Nov 2013 11:39:24 +0800	[thread overview]
Message-ID: <5282F46C.5040403@cn.fujitsu.com> (raw)
In-Reply-To: <000001cedf66$46a9bb70$d3fd3250$@samsung.com>

On 11/12/2013 01:15 PM, Chao Yu wrote:

> For better read performance, we add a new function to support for merging contiguous read as the one for write.

Nice shot!

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

Acked-by: Gu Zheng <guz.fnst@cn.fujitsu.com>

> ---
>  fs/f2fs/data.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
>  fs/f2fs/f2fs.h |    2 ++
>  2 files changed, 47 insertions(+)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index aa3438c..f30060b 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -404,6 +404,51 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page,
>  	return 0;
>  }
>  
> +void f2fs_submit_read_bio(struct f2fs_sb_info *sbi, int rw)
> +{
> +	down_read(&sbi->bio_sem);
> +	if (sbi->read_bio) {
> +		submit_bio(rw, sbi->read_bio);
> +		sbi->read_bio = NULL;
> +	}
> +	up_read(&sbi->bio_sem);
> +}
> +
> +void submit_read_page(struct f2fs_sb_info *sbi, struct page *page,
> +					block_t blk_addr, int rw)
> +{
> +	struct block_device *bdev = sbi->sb->s_bdev;
> +	int bio_blocks;
> +
> +	verify_block_addr(sbi, blk_addr);
> +
> +	down_read(&sbi->bio_sem);
> +
> +	if (sbi->read_bio && sbi->last_read_block != blk_addr - 1) {
> +		submit_bio(rw, sbi->read_bio);
> +		sbi->read_bio = NULL;
> +	}
> +
> +alloc_new:
> +	if (sbi->read_bio == NULL) {
> +		bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
> +		sbi->read_bio = f2fs_bio_alloc(bdev, bio_blocks);
> +		sbi->read_bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
> +		sbi->read_bio->bi_end_io = read_end_io;
> +	}
> +
> +	if (bio_add_page(sbi->read_bio, page, PAGE_CACHE_SIZE, 0) <
> +							PAGE_CACHE_SIZE) {
> +		submit_bio(rw, sbi->read_bio);
> +		sbi->read_bio = NULL;
> +		goto alloc_new;
> +	}
> +
> +	sbi->last_read_block = blk_addr;
> +
> +	up_read(&sbi->bio_sem);
> +}
> +
>  /*
>   * This function should be used by the data read flow only where it
>   * does not check the "create" flag that indicates block allocation.
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 89dc750..0afdcec 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -359,6 +359,8 @@ struct f2fs_sb_info {
>  
>  	/* for segment-related operations */
>  	struct f2fs_sm_info *sm_info;		/* segment manager */
> +	struct bio *read_bio;			/* read bios to merge */
> +	sector_t last_read_block;		/* last read block number */
>  	struct bio *bio[NR_PAGE_TYPE];		/* bios to merge */
>  	sector_t last_block_in_bio[NR_PAGE_TYPE];	/* last block number */
>  	struct rw_semaphore bio_sem;		/* IO semaphore */



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

WARNING: multiple messages have this Message-ID (diff)
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
To: Chao Yu <chao2.yu@samsung.com>
Cc: ??? <jaegeuk.kim@samsung.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, 谭姝 <shu.tan@samsung.com>
Subject: Re: [f2fs-dev] [PATCH 1/2] f2fs: add a new function to support for merging contiguous read
Date: Wed, 13 Nov 2013 11:39:24 +0800	[thread overview]
Message-ID: <5282F46C.5040403@cn.fujitsu.com> (raw)
In-Reply-To: <000001cedf66$46a9bb70$d3fd3250$@samsung.com>

On 11/12/2013 01:15 PM, Chao Yu wrote:

> For better read performance, we add a new function to support for merging contiguous read as the one for write.

Nice shot!

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

Acked-by: Gu Zheng <guz.fnst@cn.fujitsu.com>

> ---
>  fs/f2fs/data.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
>  fs/f2fs/f2fs.h |    2 ++
>  2 files changed, 47 insertions(+)
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index aa3438c..f30060b 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -404,6 +404,51 @@ int f2fs_readpage(struct f2fs_sb_info *sbi, struct page *page,
>  	return 0;
>  }
>  
> +void f2fs_submit_read_bio(struct f2fs_sb_info *sbi, int rw)
> +{
> +	down_read(&sbi->bio_sem);
> +	if (sbi->read_bio) {
> +		submit_bio(rw, sbi->read_bio);
> +		sbi->read_bio = NULL;
> +	}
> +	up_read(&sbi->bio_sem);
> +}
> +
> +void submit_read_page(struct f2fs_sb_info *sbi, struct page *page,
> +					block_t blk_addr, int rw)
> +{
> +	struct block_device *bdev = sbi->sb->s_bdev;
> +	int bio_blocks;
> +
> +	verify_block_addr(sbi, blk_addr);
> +
> +	down_read(&sbi->bio_sem);
> +
> +	if (sbi->read_bio && sbi->last_read_block != blk_addr - 1) {
> +		submit_bio(rw, sbi->read_bio);
> +		sbi->read_bio = NULL;
> +	}
> +
> +alloc_new:
> +	if (sbi->read_bio == NULL) {
> +		bio_blocks = MAX_BIO_BLOCKS(max_hw_blocks(sbi));
> +		sbi->read_bio = f2fs_bio_alloc(bdev, bio_blocks);
> +		sbi->read_bio->bi_sector = SECTOR_FROM_BLOCK(sbi, blk_addr);
> +		sbi->read_bio->bi_end_io = read_end_io;
> +	}
> +
> +	if (bio_add_page(sbi->read_bio, page, PAGE_CACHE_SIZE, 0) <
> +							PAGE_CACHE_SIZE) {
> +		submit_bio(rw, sbi->read_bio);
> +		sbi->read_bio = NULL;
> +		goto alloc_new;
> +	}
> +
> +	sbi->last_read_block = blk_addr;
> +
> +	up_read(&sbi->bio_sem);
> +}
> +
>  /*
>   * This function should be used by the data read flow only where it
>   * does not check the "create" flag that indicates block allocation.
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 89dc750..0afdcec 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -359,6 +359,8 @@ struct f2fs_sb_info {
>  
>  	/* for segment-related operations */
>  	struct f2fs_sm_info *sm_info;		/* segment manager */
> +	struct bio *read_bio;			/* read bios to merge */
> +	sector_t last_read_block;		/* last read block number */
>  	struct bio *bio[NR_PAGE_TYPE];		/* bios to merge */
>  	sector_t last_block_in_bio[NR_PAGE_TYPE];	/* last block number */
>  	struct rw_semaphore bio_sem;		/* IO semaphore */



  reply	other threads:[~2013-11-13  3:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-12  5:15 [PATCH 1/2] f2fs: add a new function to support for merging contiguous read Chao Yu
2013-11-12  5:15 ` [f2fs-dev] " Chao Yu
2013-11-13  3:39 ` Gu Zheng [this message]
2013-11-13  3:39   ` Gu Zheng

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=5282F46C.5040403@cn.fujitsu.com \
    --to=guz.fnst@cn.fujitsu.com \
    --cc=chao2.yu@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 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.