diff options
author | Alex Elder <elder@dreamhost.com> | 2012-11-01 10:17:15 -0500 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2013-01-17 14:12:31 -0600 |
commit | f5400b7a0e78a53edce8960a079aa022640849a1 (patch) | |
tree | 3f6e78153f0057ca2ab38a029ef0c973278e0c4c /drivers/block | |
parent | 4fb5d671399e83d3875593db2f56d5b57fcb104f (diff) | |
download | blackbird-op-linux-f5400b7a0e78a53edce8960a079aa022640849a1.tar.gz blackbird-op-linux-f5400b7a0e78a53edce8960a079aa022640849a1.zip |
rbd: add a warning in bio_chain_clone_range()
Add a warning in bio_chain_clone_range() to help a user determine
what exactly might have led to a failure. There is only one; please
say something if you disagree with the following reasoning.
There are three places this can return abnormally:
- Initially, if there is nothing to clone. It turns out that
right now this cannot happen anyway. The test is in place
because the code below it doesn't work if those conditions
don't hold. As such they could be assertions but since I can
return a null to indicate an error I just do that instead.
I have not added a warning here because it won't happen.
- While processing bio's, if none remain but there are supposed
to be more bytes to clone. Here I have added a warning.
- If bio_clone_range() returns a null pointer. That function
will have already produced a warning (at least the first
time, via WARN_ON_ONCE()) to distinguish the cause of the
error. The only exception is memory exhaustion, and I'd
rather not pepper the code with warnings in all those spots.
So no warning is added in that place.
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/rbd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 31da8c538480..ce6c0cbb3d7a 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -993,8 +993,10 @@ static struct bio *bio_chain_clone_range(struct bio **bio_src, unsigned int bi_size; struct bio *bio; - if (!bi) + if (!bi) { + rbd_warn(NULL, "bio_chain exhausted with %u left", len); goto out_err; /* EINVAL; ran out of bio's */ + } bi_size = min_t(unsigned int, bi->bi_size - off, len); bio = bio_clone_range(bi, off, bi_size, gfpmask); if (!bio) |