All of lore.kernel.org
 help / color / mirror / Atom feed
From: Muthu Kumar <muthu.lkml@gmail.com>
To: Jens Axboe <jaxboe@fusionio.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH]: block: try-2 (modified): Initialize bi_rw in mpage so bio_add can make use of it.
Date: Mon, 11 Jul 2011 10:52:02 -0700	[thread overview]
Message-ID: <CAFR8ueetLzSwTEc7D1zW4Yhd8t8iFbKvjJ07onWVQJbhzSOXLQ@mail.gmail.com> (raw)
In-Reply-To: <4E1B37B1.9030608@fusionio.com>

> For this particular case, doing it when the bio is allocated makes more
> sense. That will avoid a similar error in there in the future.
>

Sounds good. Thanks. How about for other cases that alloc a new bio
and do bio_add_page() - like blkdev_issue_zeroout() and similar.
Should we add there too?


> Something ala the below.
>
> diff --git a/fs/mpage.c b/fs/mpage.c
> index fdfae9f..a2b8604 100644
> --- a/fs/mpage.c
> +++ b/fs/mpage.c
> @@ -80,7 +80,7 @@ static struct bio *mpage_bio_submit(int rw, struct bio *bio)
>
>  static struct bio *
>  mpage_alloc(struct block_device *bdev,
> -               sector_t first_sector, int nr_vecs,
> +               sector_t first_sector, int nr_vecs, int rw,
>                gfp_t gfp_flags)
>  {
>        struct bio *bio;
> @@ -93,8 +93,9 @@ mpage_alloc(struct block_device *bdev,
>        }
>
>        if (bio) {
> -               bio->bi_bdev = bdev;
>                bio->bi_sector = first_sector;
> +               bio->bi_bdev = bdev;
> +               bio->bi_rw = rw;
>        }
>        return bio;
>  }
> @@ -288,7 +289,7 @@ alloc_new:
>        if (bio == NULL) {
>                bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
>                                min_t(int, nr_pages, bio_get_nr_vecs(bdev)),
> -                               GFP_KERNEL);
> +                               READ, GFP_KERNEL);
>                if (bio == NULL)
>                        goto confused;
>        }
> @@ -580,7 +581,8 @@ page_is_mapped:
>  alloc_new:
>        if (bio == NULL) {
>                bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
> -                               bio_get_nr_vecs(bdev), GFP_NOFS|__GFP_HIGH);
> +                               bio_get_nr_vecs(bdev), WRITE,
> +                               GFP_NOFS|__GFP_HIGH);
>                if (bio == NULL)
>                        goto confused;
>        }
>
> --
> Jens Axboe
>
>

  reply	other threads:[~2011-07-11 17:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11 17:31 [PATCH]: block: try-2 (modified): Initialize bi_rw in mpage so bio_add can make use of it Muthu Kumar
2011-07-11 17:49 ` Jens Axboe
2011-07-11 17:52   ` Muthu Kumar [this message]
2011-07-11 17:59     ` Jens Axboe
2011-07-18 18:54       ` Muthu Kumar
2011-07-18 19:13         ` Muthu Kumar
2011-07-25 17:22           ` Muthu Kumar
2011-07-26 13:20             ` Jens Axboe

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=CAFR8ueetLzSwTEc7D1zW4Yhd8t8iFbKvjJ07onWVQJbhzSOXLQ@mail.gmail.com \
    --to=muthu.lkml@gmail.com \
    --cc=jaxboe@fusionio.com \
    --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.