Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: Chandan Rajendra <chandan@linux.vnet.ibm.com>,
	<linux-btrfs@vger.kernel.org>
Cc: <clm@fb.com>, <bo.li.liu@oracle.com>, <dsterba@suse.cz>,
	<chandan@mykolab.com>, <quwenruo@cn.fujitsu.com>
Subject: Re: [PATCH V2 03/11] Btrfs: Direct I/O read: Work on sectorsized blocks
Date: Fri, 7 Aug 2015 14:46:59 -0400	[thread overview]
Message-ID: <55C4FD23.5060500@fb.com> (raw)
In-Reply-To: <1438931158-20888-4-git-send-email-chandan@linux.vnet.ibm.com>

On 08/07/2015 03:05 AM, Chandan Rajendra wrote:
> The direct I/O read's endio and corresponding repair functions work on
> page sized blocks. This commit adds the ability for direct I/O read to work on
> subpagesized blocks.
>
> Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
> ---
>   fs/btrfs/inode.c | 96 ++++++++++++++++++++++++++++++++++++++++++--------------
>   1 file changed, 73 insertions(+), 23 deletions(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index e33dff3..ff8b699 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -7630,9 +7630,9 @@ static int btrfs_check_dio_repairable(struct inode *inode,
>   }
>
>   static int dio_read_error(struct inode *inode, struct bio *failed_bio,
> -			  struct page *page, u64 start, u64 end,
> -			  int failed_mirror, bio_end_io_t *repair_endio,
> -			  void *repair_arg)
> +			struct page *page, unsigned int pgoff,
> +			u64 start, u64 end, int failed_mirror,
> +			bio_end_io_t *repair_endio, void *repair_arg)
>   {
>   	struct io_failure_record *failrec;
>   	struct bio *bio;
> @@ -7653,7 +7653,9 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio,
>   		return -EIO;
>   	}
>
> -	if (failed_bio->bi_vcnt > 1)
> +	if ((failed_bio->bi_vcnt > 1)
> +		|| (failed_bio->bi_io_vec->bv_len
> +			> BTRFS_I(inode)->root->sectorsize))
>   		read_mode = READ_SYNC | REQ_FAILFAST_DEV;
>   	else
>   		read_mode = READ_SYNC;
> @@ -7661,7 +7663,7 @@ static int dio_read_error(struct inode *inode, struct bio *failed_bio,
>   	isector = start - btrfs_io_bio(failed_bio)->logical;
>   	isector >>= inode->i_sb->s_blocksize_bits;
>   	bio = btrfs_create_repair_bio(inode, failed_bio, failrec, page,
> -				      0, isector, repair_endio, repair_arg);
> +				pgoff, isector, repair_endio, repair_arg);
>   	if (!bio) {
>   		free_io_failure(inode, failrec);
>   		return -EIO;
> @@ -7691,12 +7693,17 @@ struct btrfs_retry_complete {
>   static void btrfs_retry_endio_nocsum(struct bio *bio, int err)
>   {
>   	struct btrfs_retry_complete *done = bio->bi_private;
> +	struct inode *inode;
>   	struct bio_vec *bvec;
>   	int i;
>
>   	if (err)
>   		goto end;
>
> +	BUG_ON(bio->bi_vcnt != 1);

Let's use ASSERT() instead of BUG_ON() for logic errors that developers 
should catch.  Thanks,

Josef

  reply	other threads:[~2015-08-07 18:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07  7:05 [PATCH V2 00/11] Btrfs: Pre subpagesize-blocksize cleanups Chandan Rajendra
2015-08-07  7:05 ` [PATCH V2 01/11] Btrfs: __btrfs_buffered_write: Reserve/release extents aligned to block size Chandan Rajendra
2015-08-07  7:05 ` [PATCH V2 02/11] Btrfs: Compute and look up csums based on sectorsized blocks Chandan Rajendra
2015-08-07 18:30   ` Josef Bacik
2015-08-09 11:47     ` Chandan Rajendra
2015-08-07  7:05 ` [PATCH V2 03/11] Btrfs: Direct I/O read: Work " Chandan Rajendra
2015-08-07 18:46   ` Josef Bacik [this message]
2015-08-07  7:05 ` [PATCH V2 04/11] Btrfs: fallocate: Work with " Chandan Rajendra
2015-08-07  7:05 ` [PATCH V2 05/11] Btrfs: btrfs_page_mkwrite: Reserve space in sectorsized units Chandan Rajendra
2015-08-07  7:05 ` [PATCH V2 06/11] Btrfs: Search for all ordered extents that could span across a page Chandan Rajendra
2015-08-07  7:05 ` [PATCH V2 07/11] Btrfs: Use (eb->start, seq) as search key for tree modification log Chandan Rajendra
2015-08-07  7:05 ` [PATCH V2 08/11] Btrfs: btrfs_submit_direct_hook: Handle map_length < bio vector length Chandan Rajendra
2015-08-07  7:05 ` [PATCH V2 09/11] Btrfs: Limit inline extents to root->sectorsize Chandan Rajendra
2015-08-07  7:05 ` [PATCH V2 10/11] Btrfs: Fix block size returned to user space Chandan Rajendra
2015-08-07  7:05 ` [PATCH V2 11/11] Btrfs: Clean pte corresponding to page straddling i_size Chandan Rajendra

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=55C4FD23.5060500@fb.com \
    --to=jbacik@fb.com \
    --cc=bo.li.liu@oracle.com \
    --cc=chandan@linux.vnet.ibm.com \
    --cc=chandan@mykolab.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo@cn.fujitsu.com \
    /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