All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] aio: remove 'always false' check
@ 2012-07-11  9:15 Yuanhan Liu
  2012-07-11 14:17 ` Jeff Moyer
  0 siblings, 1 reply; 3+ messages in thread
From: Yuanhan Liu @ 2012-07-11  9:15 UTC (permalink / raw)
  To: bcrl; +Cc: viro, linux-fsdevel, Yuanhan Liu

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.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
---
 fs/aio.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/fs/aio.c b/fs/aio.c
index 55c4c76..7248327 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -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;
-- 
1.7.7.6


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] aio: remove 'always false' check
  2012-07-11  9:15 [PATCH] aio: remove 'always false' check Yuanhan Liu
@ 2012-07-11 14:17 ` Jeff Moyer
  2012-07-13  1:35   ` Yuanhan Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Moyer @ 2012-07-11 14:17 UTC (permalink / raw)
  To: Yuanhan Liu; +Cc: bcrl, viro, linux-fsdevel

Yuanhan Liu <yuanhan.liu@linux.intel.com> writes:

> 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().

Right, the number of events is limited to what will fit in 256MB, for
some odd reason.  Maybe Ben can comment on that.

> Thus, nr_pages will 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] aio: remove 'always false' check
  2012-07-11 14:17 ` Jeff Moyer
@ 2012-07-13  1:35   ` Yuanhan Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Yuanhan Liu @ 2012-07-13  1:35 UTC (permalink / raw)
  To: Jeff Moyer; +Cc: bcrl, viro, linux-fsdevel

Hi Jeff,

On Wed, Jul 11, 2012 at 10:17:26AM -0400, Jeff Moyer wrote:
> Yuanhan Liu <yuanhan.liu@linux.intel.com> writes:
> 
> > 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().
> 
> Right, the number of events is limited to what will fit in 256MB, for
> some odd reason.  Maybe Ben can comment on that.
> 
> > Thus, nr_pages will 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 :)

> 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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-07-13  1:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11  9:15 [PATCH] aio: remove 'always false' check Yuanhan Liu
2012-07-11 14:17 ` Jeff Moyer
2012-07-13  1:35   ` Yuanhan Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.