Skip to contentSkip to conversation

kill pointless ki_nbytes assignment in aio_setup_single_vector

PATCH In review Chen, Kenneth W 2 participants 2 messages Dec 4, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kill pointless ki_nbytes assignment in aio_setup_single_vector

io_submit_one assigns ki_left = ki_nbytes = iocb->aio_nbytes, then calls down to aio_setup_iocb, then to aio_setup_single_vector. In there, ki_nbytes is reassigned to the same value it got two call stack above it. There is no need to do so.

fs/aio.c +0 -1
diff -Nurp linux-2.6.19/fs/aio.c linux-2.6.19.ken/fs/aio.c
@@ -1415,7 +1415,6 @@ static ssize_t aio_setup_single_vector(s
 	kiocb->ki_iovec->iov_len = kiocb->ki_left;
 	kiocb->ki_nr_segs = 1;
 	kiocb->ki_cur_seg = 0;
-	kiocb->ki_nbytes = kiocb->ki_left;
 	if (unlikely((ssize_t) kiocb->ki_nbytes < 0))
 		return -EINVAL;
 	return 0;
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Kenneth W

io_submit_one assigns ki_left = ki_nbytes = iocb->aio_nbytes, then calls down to aio_setup_iocb, then to aio_setup_single_vector. In there, ki_nbytes is reassigned to the same value it got two call stack above it. There is no need to do so.

That seems to be the case, indeed.

- z