Re: [PATCH 01/11] dm io: fix bi_max_vecs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 22 2006, Alasdair G Kergon wrote:
> From: Heinz Mauelshagen <[email protected]>
> 
> The existing code allocates an extra slot in bi_io_vec[] and uses it to
> store the region number.
> 
> This patch hides the extra slot from bio_add_page() so the region number
> can't get overwritten.
> 
> Also remove a hard-coded SECTOR_SHIFT and fix a typo in a comment.
>
> Index: linux-2.6.19-rc6/drivers/md/dm-io.c
> ===================================================================
> --- linux-2.6.19-rc6.orig/drivers/md/dm-io.c	2006-11-22 17:26:47.000000000 +0000
> +++ linux-2.6.19-rc6/drivers/md/dm-io.c	2006-11-22 17:26:53.000000000 +0000
> @@ -92,12 +92,12 @@ void dm_io_put(unsigned int num_pages)
>   *---------------------------------------------------------------*/
>  static inline void bio_set_region(struct bio *bio, unsigned region)
>  {
> -	bio->bi_io_vec[bio->bi_max_vecs - 1].bv_len = region;
> +	bio->bi_io_vec[bio->bi_max_vecs].bv_len = region;
>  }
>  

Ehm eww, that is really ugly code imo.

-- 
Jens Axboe

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux