]> git.karo-electronics.de Git - karo-tx-linux.git/commit
Use the recently-added bio front_pad field to allocate struct dm_target_io.
authorMikulas Patocka <mpatocka@redhat.com>
Thu, 20 Sep 2012 23:40:13 +0000 (09:40 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 20 Sep 2012 23:40:13 +0000 (09:40 +1000)
commite004254ef8bfd82a24b36e058d9d816f3d4030fa
tree136b4e94035dc03342d32e548bfd642b87db69a2
parent8b3521524e4c61abad04b11dd5be409dca6c01b0
Use the recently-added bio front_pad field to allocate struct dm_target_io.

Prior to this patch, dm_target_io was allocated from a mempool. For each
dm_target_io, there is exactly one bio allocated from a bioset.

This patch merges these two allocations into one allocation: we create a
bioset with front_pad equal to the size of dm_target_io so that every
bio allocated from the bioset has sizeof(struct dm_target_io) bytes
before it. We allocate a bio and use the bytes before the bio as
dm_target_io.

This idea was introduced by Kent Overstreet.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: Kent Overstreet <koverstreet@google.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: tj@kernel.org
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
drivers/md/dm.c