mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>, Shaohua Li <shli@fusionio.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] block: makes bio_split support bio without data
Date: Tue, 25 Sep 2012 09:37:43 +1000	[thread overview]
Message-ID: <20120925093743.757f0a95@notabene.brown> (raw)
In-Reply-To: <87txunyg15.fsf@sejong.aot.lge.com>

[-- Attachment #1: Type: text/plain, Size: 1737 bytes --]

On Mon, 24 Sep 2012 17:35:34 +0900 Namhyung Kim <namhyung@kernel.org> wrote:

> Hi,
> 
> On Mon, 24 Sep 2012 14:56:39 +1000, NeilBrown wrote:
> > Hi Jens,
> >  this patch has been sitting in my -next tree for a little while and I was
> >  hoping for it to go in for the next merge window.
> >  It simply allows bio_split() to be used on bios without a payload, such as
> >  'discard'.
> >  Are you happy with it going in though my 'md' tree, or would you rather take
> >  it though your 'block' tree?
> >
> > Thanks,
> > NeilBrown
> >
> >
> > From: Shaohua Li <shli@fusionio.com>
> > Date: Thu, 20 Sep 2012 09:36:03 +1000
> > Subject: [PATCH] block: makes bio_split support bio without data
> >
> > discard bio hasn't data attached. We hit a BUG_ON with such bio. This makes
> > bio_split works for such bio.
> >
> > Signed-off-by: Shaohua Li <shli@fusionio.com>
> > Signed-off-by: NeilBrown <neilb@suse.de>
> >
> > diff --git a/fs/bio.c b/fs/bio.c
> > index 71072ab..dbb7a6c 100644
> > --- a/fs/bio.c
> > +++ b/fs/bio.c
> > @@ -1501,7 +1501,7 @@ struct bio_pair *bio_split(struct bio *bi, int first_sectors)
> >  	trace_block_split(bdev_get_queue(bi->bi_bdev), bi,
> >  				bi->bi_sector + first_sectors);
> >  
> > -	BUG_ON(bi->bi_vcnt != 1);
> > +	BUG_ON(bi->bi_vcnt != 1 && bi->bi_vcnt != 0);
> 
> Why not
> 	BUG_ON(bi->bi_vcnt > 1);
> ?

Either is fine with me.
'1' and '0' are the cases that bio_split explicitly supports.
'>1' are the cases which will cause problems.

As bi_vnt is unsigned, both conditions should produce exactly the same
machine code.

As I see no reason to prefer one over the other, I'm happy to go with what the
original author wrote.

Thanks,
NeilBrown

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

  reply	other threads:[~2012-09-24 23:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24  4:56 NeilBrown
2012-09-24  8:35 ` Namhyung Kim
2012-09-24 23:37   ` NeilBrown [this message]
2012-09-25 12:51 ` Jens Axboe
2012-09-28  7:36   ` Shaohua Li
2012-09-28  8:39     ` Jens Axboe
2012-09-28 16:23 ` Kent Overstreet
2012-10-02  6:22   ` NeilBrown
2012-10-02 21:09     ` Kent Overstreet
2012-10-03  3:30       ` NeilBrown
2012-10-03  3:42         ` Kent Overstreet
2012-10-03 16:22           ` Martin K. Petersen

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=20120925093743.757f0a95@notabene.brown \
    --to=neilb@suse.de \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    --cc=shli@fusionio.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

all inboxes | Powered by JetHome®