From: Carlos Maiolino <cmaiolino@redhat.com>
To: linux-xfs@vger.kernel.org
Subject: [PATCH] xfs_buf: Remove unneeded variable from xfs_buf_ioapply_map
Date: Mon, 13 Aug 2018 15:46:01 +0200 [thread overview]
Message-ID: <20180813134601.29390-1-cmaiolino@redhat.com> (raw)
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
reply other threads:[~2018-08-13 16:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180813134601.29390-1-cmaiolino@redhat.com \
--to=cmaiolino@redhat.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).