diff options
author | Isaac Huang <[email protected]> | 2014-10-21 12:20:10 -0600 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-11-19 12:50:49 -0500 |
commit | 29b763cd2c13e355b60fa095a6f20cf8a38f8651 (patch) | |
tree | 51e047ddee98086dc231fa02971310bfc441a0f6 /module/zfs/vdev_disk.c | |
parent | aaed7c408c0bd72c6f9437793a98542972f0a8fd (diff) |
bio_alloc() with __GFP_WAIT never returns NULL
Mark the error handling branch as unlikely() because the current
kernel interface can never return NULL. However, we want to keep
the error handling in case this behavior changes in the futre.
Plus fix a small style issue.
Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Isaac Huang <[email protected]>
Closes #2703
Diffstat (limited to 'module/zfs/vdev_disk.c')
-rw-r--r-- | module/zfs/vdev_disk.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/module/zfs/vdev_disk.c b/module/zfs/vdev_disk.c index 9cc6745d1..ec93884ed 100644 --- a/module/zfs/vdev_disk.c +++ b/module/zfs/vdev_disk.c @@ -520,7 +520,7 @@ retry: return (ENOMEM); if (zio && !(zio->io_flags & (ZIO_FLAG_IO_RETRY | ZIO_FLAG_TRYHARD))) - bio_set_flags_failfast(bdev, &flags); + bio_set_flags_failfast(bdev, &flags); dr->dr_zio = zio; dr->dr_rw = flags; @@ -554,7 +554,8 @@ retry: dr->dr_bio[i] = bio_alloc(GFP_NOIO, bio_nr_pages(bio_ptr, bio_size)); - if (dr->dr_bio[i] == NULL) { + /* bio_alloc() with __GFP_WAIT never returns NULL */ + if (unlikely(dr->dr_bio[i] == NULL)) { vdev_disk_dio_free(dr); return (ENOMEM); } @@ -642,7 +643,8 @@ vdev_disk_io_flush(struct block_device *bdev, zio_t *zio) return (ENXIO); bio = bio_alloc(GFP_NOIO, 0); - if (!bio) + /* bio_alloc() with __GFP_WAIT never returns NULL */ + if (unlikely(bio == NULL)) return (ENOMEM); bio->bi_end_io = vdev_disk_io_flush_completion; |