All of lore.kernel.org
 help / color / mirror / Atom feed
* About function bio_detain in file dm-cache-target.c
@ 2013-03-12  7:47 majianpeng
  2013-03-12 13:23 ` thornber
  0 siblings, 1 reply; 2+ messages in thread
From: majianpeng @ 2013-03-12  7:47 UTC (permalink / raw)
  To: alasdair G Kergon; +Cc: dm-devel

Hi all,
    I think bio_detain(in dm-cache-target.c) may cause some bug.
>static int bio_detain(struct cache *cache, dm_oblock_t oblock,
>                      struct bio *bio, struct dm_bio_prison_cell *cell_prealloc,
>                      cell_free_fn free_fn, void *free_context,
>                      struct dm_bio_prison_cell **cell_result)
>{
>       int r;
>        struct dm_cell_key key;

>        build_key(oblock, &key);
>        r = dm_bio_detain(cache->prison, &key, bio, cell_prealloc, cell_result);
>       if (r)
>                free_fn(free_context, cell_prealloc);

>     return r;
>}
If the returned value of dm_bio_detain is not zero, it indicated cell existing.So it should defer bio.
But in dm_bio_detain-->bio_detain--->__bio->detain
>        cell = __search_bucket(prison->cells + hash, key);
>        if (cell) {
>               if (inmate)
>                        bio_list_add(&cell->bios, inmate);
>                *cell_result = cell;
>                return 1;
>        }  
If found the cell, it will add bio to ->bios of cell.

Maybe bio_detain(in dm-cache) is like:
    r=dm_get_cell();
    if (!r)
      dm_bio_detain


Thanks!
Jianpeng Ma

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-03-12 13:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-12  7:47 About function bio_detain in file dm-cache-target.c majianpeng
2013-03-12 13:23 ` thornber

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.