On Fri, Oct 19, 2012 at 08:31:17PM -0600, Liu Bo wrote:
> On 10/20/2012 05:01 AM, Josef Bacik wrote:
> > Alex reported a problem where we were writing between chunks on a rbd
> > device. The thing is we do bio_add_page using logical offsets, but the
> > physical offset may be different. So when we map the bio now check to see
> > if the bio is still ok with the physical offset, and if it is not split the
> > bio up and redo the bio_add_page with the physical sector. This fixes the
> > problem for Alex and doesn't affect performance in the normal case. Thanks,
> >
> > Reported-and-tested-by: Alex Elder <elder@xxxxxxxxxxx>
> > Signed-off-by: Josef Bacik <jbacik@xxxxxxxxxxxx>
> > ---
> > fs/btrfs/volumes.c | 159 ++++++++++++++++++++++++++++++++++++++++++---------
> > 1 files changed, 131 insertions(+), 28 deletions(-)
> >
> > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> > index a8adf26..eaaf0bf 100644
> > --- a/fs/btrfs/volumes.c
> > +++ b/fs/btrfs/volumes.c
> > @@ -4217,6 +4217,113 @@ static noinline void schedule_bio(struct btrfs_root *root,
> > &device->work);
> > }
> >
> > +static int bio_size_ok(struct block_device *bdev, struct bio *bio,
> > + sector_t sector)
> > +{
> > + struct bio_vec *prev;
> > + struct request_queue *q = bdev_get_queue(bdev);
> > + unsigned short max_sectors = queue_max_sectors(q);
> > + struct bvec_merge_data bvm = {
> > + .bi_bdev = bdev,
> > + .bi_sector = sector,
> > + .bi_rw = bio->bi_rw,
> > + };
> > +
> > + if (bio->bi_vcnt == 0) {
> > + WARN_ON(1);
> > + return 1;
> > + }
> > +
> > + prev = &bio->bi_io_vec[bio->bi_vcnt - 1];
>
> I prefer 'last' for this.
>
>
> Others look good to me :)
>
> Reviewed-by: Liu Bo <bo.li.liu@xxxxxxxxxx>
>
Heh I had made that change but apparently didn't commit it before I sent it out.
Thanks,
Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html