From: majianpeng <majianpeng@gmail.com>
To: alasdair G Kergon <agk@redhat.com>
Cc: dm-devel@redhat.com
Subject: About function bio_detain in file dm-cache-target.c
Date: Tue, 12 Mar 2013 15:47:28 +0800 [thread overview]
Message-ID: <513EDD90.6090305@gmail.com> (raw)
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
next reply other threads:[~2013-03-12 7:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-12 7:47 majianpeng [this message]
2013-03-12 13:23 ` About function bio_detain in file dm-cache-target.c thornber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=513EDD90.6090305@gmail.com \
--to=majianpeng@gmail.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.