linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs_buf: Remove unneeded variable from xfs_buf_ioapply_map
@ 2018-08-13 13:46 Carlos Maiolino
  0 siblings, 0 replies; only message in thread
From: Carlos Maiolino @ 2018-08-13 13:46 UTC (permalink / raw)
  To: linux-xfs

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 --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;
-- 
2.14.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-08-13 16:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-13 13:46 [PATCH] xfs_buf: Remove unneeded variable from xfs_buf_ioapply_map Carlos Maiolino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).