Skip to contentSkip to conversation

fs/direct-io: remove redundant comparison

PATCH In review Gu Zheng 2 participants 2 messages Feb 21, 2014 VFS

lore
Share & tools
lore

Gu Zheng

author
#0 lore raw

PATCH 1/1 fs/direct-io: remove redundant comparison

The return value of bio_get_nr_vecs() can not bigger than BIO_MAX_PAGES, so we can remove redundant the comparison between nr_pages and BIO_MAX_PAGES.

---
 fs/direct-io.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
fs/direct-io.c +0 -1
index 160a548..6e6bff3 100644
@@ -664,7 +664,6 @@ static inline int dio_new_bio(struct dio *dio, struct dio_submit *sdio,
 		goto out;
 	sector = start_sector << (sdio->blkbits - 9);
 	nr_pages = min(sdio->pages_in_io, bio_get_nr_vecs(map_bh->b_bdev));
-	nr_pages = min(nr_pages, BIO_MAX_PAGES);
 	BUG_ON(nr_pages <= 0);
 	dio_bio_alloc(dio, sdio, map_bh->b_bdev, sector, nr_pages);
 	sdio->boundary = 0;
Signature · 1 line
1.7.7
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Gu Zheng

The return value of bio_get_nr_vecs() can not bigger than BIO_MAX_PAGES, so we can remove redundant the comparison between nr_pages and BIO_MAX_PAGES.

Yeah, commit f908ee94 (bio allocation failure due to bio_get_nr_vecs()) added that bounding.

Quoted 18 lines
---
 fs/direct-io.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
fs/direct-io.c +0 -1
index 160a548..6e6bff3 100644
@@ -664,7 +664,6 @@ static inline int dio_new_bio(struct dio *dio, struct dio_submit *sdio,
 		goto out;
 	sector = start_sector << (sdio->blkbits - 9);
 	nr_pages = min(sdio->pages_in_io, bio_get_nr_vecs(map_bh->b_bdev));
-	nr_pages = min(nr_pages, BIO_MAX_PAGES);
 	BUG_ON(nr_pages <= 0);
 	dio_bio_alloc(dio, sdio, map_bh->b_bdev, sector, nr_pages);
 	sdio->boundary = 0;