diff mbox series

xfs_buf: Remove unneeded variable from xfs_buf_ioapply_map

Message ID 20180813134601.29390-1-cmaiolino@redhat.com (mailing list archive)
State New, archived
Headers show
Series xfs_buf: Remove unneeded variable from xfs_buf_ioapply_map | expand

Commit Message

Carlos Maiolino Aug. 13, 2018, 1:46 p.m. UTC
bio_add_page only returns 0 or the same value passed as length, there is
no need to compare its return value against the passed length.

Just check if the return value is 0 or not.


Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---

P.S. Patch survived xfstests using different block sizes

 fs/xfs/xfs_buf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index e839907e8492..a353b39b00e2 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -1306,14 +1306,14 @@  xfs_buf_ioapply_map(
 	bio_set_op_attrs(bio, op, op_flags);
 
 	for (; size && nr_pages; nr_pages--, page_index++) {
-		int	rbytes, nbytes = PAGE_SIZE - offset;
+		int	nbytes = PAGE_SIZE - offset;
 
 		if (nbytes > size)
 			nbytes = size;
 
-		rbytes = bio_add_page(bio, bp->b_pages[page_index], nbytes,
-				      offset);
-		if (rbytes < nbytes)
+		/* Stop if bio is full */
+		if (!(bio_add_page(bio, bp->b_pages[page_index], nbytes,
+				   offset)))
 			break;
 
 		offset = 0;