public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Russell Cattelan <cattelan@xfs.org>
Cc: Linux Kernel List <linux-kernel@vger.kernel.org>
Subject: Re: Small bug in bio_clone?
Date: Sat, 20 Mar 2004 11:17:50 +0100	[thread overview]
Message-ID: <20040320101750.GE2711@suse.de> (raw)
In-Reply-To: <1079734269.3373.42.camel@naboo.americas.sgi.com>

On Fri, Mar 19 2004, Russell Cattelan wrote:
> Shouldn't __bio_clone be checking the state flags
> of the src bio?
> 
> --- /usr/tmp/TmpDir.29150-0/fs/bio.c_1.3        2004-03-19
> 16:07:12.000000000 -0600
> +++ fs/bio.c    2004-03-19 16:06:24.348491070 -0600
> @@ -225,7 +225,7 @@
>          */
>         bio->bi_vcnt = bio_src->bi_vcnt;
>         bio->bi_idx = bio_src->bi_idx;
> -       if (bio_flagged(bio, BIO_SEG_VALID)) {
> +       if (bio_flagged(bio_src, BIO_SEG_VALID)) {
>                 bio->bi_phys_segments = bio_src->bi_phys_segments;
>                 bio->bi_hw_segments = bio_src->bi_hw_segments;
>                 bio->bi_flags |= (1 << BIO_SEG_VALID);

Yes, in theory. What is done now is for sure a mistake, however I'm
thinking it's probably safer to just delete the check and setting of
segments, and do it on-demand the next time (if ever) someone calls
bio_*_segments(bio). Hmm, should be done every time someone assigns
->bi_bdev(), maybe it would be a good idea to add something like that.

static inline void bio_set_bdev(struct bio *bio, struct block_device *bdev)
{
	bio->bi_bdev = bdev;
	bio->bi_flags &= ~(1 << BIO_SEG_VALID);
}

-- 
Jens Axboe


      reply	other threads:[~2004-03-20 10:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-19 22:11 Small bug in bio_clone? Russell Cattelan
2004-03-20 10:17 ` Jens Axboe [this message]

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=20040320101750.GE2711@suse.de \
    --to=axboe@suse.de \
    --cc=cattelan@xfs.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