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

Re: [dm-devel] [PATCH 2/2] Use low pointer bits for dm io region




On Wed, 11 Nov 2009, Kiyoshi Ueda wrote:

> Hi Mikulas,
> 
> On 11/11/2009 11:05 AM +0900, Mikulas Patocka wrote:
> > Use low pointer bits for dm io region
> > 
> > We need to store two things per bio: the pointer to the main io structure and
> > a region number, an index of disk where this bio belongs to (if there is
> > simultaneous write to multiple disks). There can be at most BITS_PER_LONG
> > regions. BITS_PER_LONG is 32 on 32-bit machines and 64 on 64-bit machines.
> > 
> > A region number was stored in the last hidden bio vector and the pointer to
> > struct io was stored in bi_private.
> > 
> > This patch changes it so that "struct io" is always aligned on BITS_PER_LONG
> > bytes and region number is stored in the low BITS_PER_LONG bits of bi_private.
> 
> The code is not easily readable for me.
> Why don't you introduce a new structure in which those two things
> can be stored, and allocate/attach it per bio?
> If it's possible, the code should be easy to read and maintain, I think.

Yes, but this allocation would degrade performance for all users of dm-io. 
The whole purpose of the patch is to not have to allocate any extra 
memory.

I tried to put the bit tricks into two functions, bio_set_io_region and 
bio_get_io_region so that the lest of the code is free from them.

Mikulas


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