mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: chenlei0x@gmail.com
To: chenlei0x@gmail.com, darrick.wong@oracle.com,
	linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Lei Chen <lennychen@tencent.com>
Subject: [PATCH] xfs: clean code for setting bma length in xfs_bmapi_write
Date: Sat, 12 Dec 2020 20:48:17 +0800	[thread overview]
Message-ID: <1607777297-22269-1-git-send-email-lennychen@tencent.com> (raw)

From: Lei Chen <lennychen@tencent.com>

xfs_bmapi_write may need alloc blocks when it encounters a hole
or delay extent. When setting bma.length, it does not need comparing
MAXEXTLEN and the length that the caller wants, because
xfs_bmapi_allocate will handle every thing properly for bma.length.

Signed-off-by: Lei Chen <lennychen@tencent.com>
---
 fs/xfs/libxfs/xfs_bmap.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index dcf56bc..e1b6ac6 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -4417,18 +4417,7 @@ struct xfs_iread_state {
 			bma.wasdel = wasdelay;
 			bma.offset = bno;
 			bma.flags = flags;
-
-			/*
-			 * There's a 32/64 bit type mismatch between the
-			 * allocation length request (which can be 64 bits in
-			 * length) and the bma length request, which is
-			 * xfs_extlen_t and therefore 32 bits. Hence we have to
-			 * check for 32-bit overflows and handle them here.
-			 */
-			if (len > (xfs_filblks_t)MAXEXTLEN)
-				bma.length = MAXEXTLEN;
-			else
-				bma.length = len;
+			bma.length = len;
 
 			ASSERT(len > 0);
 			ASSERT(bma.length > 0);
-- 
1.8.3.1


             reply	other threads:[~2020-12-12 12:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-12 12:48 chenlei0x [this message]
2020-12-12 16:12 ` Gao Xiang

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=1607777297-22269-1-git-send-email-lennychen@tencent.com \
    --to=chenlei0x@gmail.com \
    --cc=darrick.wong@oracle.com \
    --cc=lennychen@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®