aio: remove 'always false' check
PATCH 1/1 aio: remove 'always false' check
The only case that nr_pages will be < 0 is that nr_pages overflowed due to nr_events is too big. But it is exclued at ioctx_alloc().
Thus, nr_pages will always > 0. So remove the dead 'if (nr_pages < 0)' code block.
--- fs/aio.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
fs/aio.c +0 -4
@@ -117,10 +117,6 @@ static int aio_setup_ring(struct kioctx *ctx) size =sizeof (struct aio_ring ); size +=sizeof (struct io_event ) * nr_events; nr_pages = (size +PAGE_SIZE -1 ) >>PAGE_SHIFT ; - -if (nr_pages <0 ) -return -EINVAL ; - nr_events = (PAGE_SIZE * nr_pages -sizeof (struct aio_ring )) /sizeof (struct io_event ); info->nr =0 ;
Signature · 1 line
1.7.7.6
Quoted 2 lines · Yuanhan Liu
The only case that
nr_pageswill be < 0 is thatnr_pagesoverflowed due tonr_eventsis too big. But it is exclued atioctx_alloc().
Right, the number of events is limited to what will fit in 256MB, for some odd reason. Maybe Ben can comment on that.
Quoted 2 lines
Thus,
nr_pageswill always > 0. So remove the dead 'if (nr_pages< 0)' code block.
Sure, but I don't see any harm in keeping this check. We do add another page to the size, so retesting for overflow is good practice, and isn't going to kill performance.
So, I'm going to NAK this.
Cheers,
Jeff
Hi Jeff,
Quoted 5 lines · Jeff Moyer
Quoted 2 lines · Yuanhan Liu
The only case that
nr_pageswill be < 0 is thatnr_pagesoverflowed due tonr_eventsis too big. But it is exclued atioctx_alloc().
Quoted 8 lines
Right, the number of events is limited to what will fit in 256MB, for some odd reason. Maybe Ben can comment on that.
Quoted 2 lines
Thus,
nr_pageswill always > 0. So remove the dead 'if (nr_pages< 0)' code block.Sure, but I don't see any harm in keeping this check. We do add another page to the size,
That would change nothing :)
Quoted 4 lines
so retesting for overflow is good practice, and isn't going to kill performance.
So, I'm going to NAK this.
I'm fine with this NAK. And, thanks for your comments.