[PATCH 10/10] dm: Remove redundant error checking

From: Joe Thornber (joe@fib011235813.fsnet.co.uk)
Date: Wed Jan 08 2003 - 05:00:42 EST


bio_alloc() shouldn't fail if GFP_NOIO is used, and the bvec count is
sensible. So remove redundant error checking.
--- diff/drivers/md/dm.c 2003-01-02 11:10:22.000000000 +0000
+++ source/drivers/md/dm.c 2003-01-02 11:27:23.000000000 +0000
@@ -347,18 +347,15 @@
         struct bio_vec *bv = bio->bi_io_vec + idx;
 
         clone = bio_alloc(GFP_NOIO, 1);
+ memcpy(clone->bi_io_vec, bv, sizeof(*bv));
 
- if (clone) {
- memcpy(clone->bi_io_vec, bv, sizeof(*bv));
-
- clone->bi_sector = sector;
- clone->bi_bdev = bio->bi_bdev;
- clone->bi_rw = bio->bi_rw;
- clone->bi_vcnt = 1;
- clone->bi_size = to_bytes(len);
- clone->bi_io_vec->bv_offset = offset;
- clone->bi_io_vec->bv_len = clone->bi_size;
- }
+ clone->bi_sector = sector;
+ clone->bi_bdev = bio->bi_bdev;
+ clone->bi_rw = bio->bi_rw;
+ clone->bi_vcnt = 1;
+ clone->bi_size = to_bytes(len);
+ clone->bi_io_vec->bv_offset = offset;
+ clone->bi_io_vec->bv_len = clone->bi_size;
 
         return clone;
 }
@@ -432,11 +429,6 @@
 
                 clone = split_bvec(bio, ci->sector, ci->idx,
                                    bv->bv_offset, max);
- if (!clone) {
- dec_pending(ci->io, -ENOMEM);
- return;
- }
-
                 __map_bio(ti, clone, ci->io);
 
                 ci->sector += max;
@@ -446,11 +438,6 @@
                 len = to_sector(bv->bv_len) - max;
                 clone = split_bvec(bio, ci->sector, ci->idx,
                                    bv->bv_offset + to_bytes(max), len);
- if (!clone) {
- dec_pending(ci->io, -ENOMEM);
- return;
- }
-
                 __map_bio(ti, clone, ci->io);
 
                 ci->sector += len;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Jan 15 2003 - 22:00:22 EST