From: Shiyang Ruan <ruansy.fnst@fujitsu.com>
To: linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev,
linux-xfs@vger.kernel.org, linux-mm@kvack.org
Cc: dan.j.williams@intel.com, willy@infradead.org, jack@suse.cz,
akpm@linux-foundation.org, djwong@kernel.org, mcgrof@kernel.org
Subject: [PATCH v12 1/2] xfs: fix the calculation for "end" and "length"
Date: Thu, 29 Jun 2023 16:16:50 +0800 [thread overview]
Message-ID: <20230629081651.253626-2-ruansy.fnst@fujitsu.com> (raw)
In-Reply-To: <20230629081651.253626-1-ruansy.fnst@fujitsu.com>
The value of "end" should be "start + length - 1".
Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/xfs_notify_failure.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/xfs/xfs_notify_failure.c b/fs/xfs/xfs_notify_failure.c
index c4078d0ec108..4a9bbd3fe120 100644
--- a/fs/xfs/xfs_notify_failure.c
+++ b/fs/xfs/xfs_notify_failure.c
@@ -114,7 +114,8 @@ xfs_dax_notify_ddev_failure(
int error = 0;
xfs_fsblock_t fsbno = XFS_DADDR_TO_FSB(mp, daddr);
xfs_agnumber_t agno = XFS_FSB_TO_AGNO(mp, fsbno);
- xfs_fsblock_t end_fsbno = XFS_DADDR_TO_FSB(mp, daddr + bblen);
+ xfs_fsblock_t end_fsbno = XFS_DADDR_TO_FSB(mp,
+ daddr + bblen - 1);
xfs_agnumber_t end_agno = XFS_FSB_TO_AGNO(mp, end_fsbno);
error = xfs_trans_alloc_empty(mp, &tp);
@@ -210,7 +211,7 @@ xfs_dax_notify_failure(
ddev_end = ddev_start + bdev_nr_bytes(mp->m_ddev_targp->bt_bdev) - 1;
/* Ignore the range out of filesystem area */
- if (offset + len < ddev_start)
+ if (offset + len - 1 < ddev_start)
return -ENXIO;
if (offset > ddev_end)
return -ENXIO;
@@ -222,8 +223,8 @@ xfs_dax_notify_failure(
len -= ddev_start - offset;
offset = 0;
}
- if (offset + len > ddev_end)
- len -= ddev_end - offset;
+ if (offset + len - 1 > ddev_end)
+ len = ddev_end - offset + 1;
return xfs_dax_notify_ddev_failure(mp, BTOBB(offset), BTOBB(len),
mf_flags);
--
2.40.1
next prev parent reply other threads:[~2023-06-29 8:19 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-29 8:16 [PATCH v12 0/2] mm, pmem, xfs: Introduce MF_MEM_REMOVE for unbind Shiyang Ruan
2023-06-29 8:16 ` Shiyang Ruan [this message]
2023-06-29 8:16 ` [PATCH v12 2/2] " Shiyang Ruan
2023-06-29 12:02 ` kernel test robot
2023-07-14 9:07 ` Shiyang Ruan
2023-07-14 14:18 ` Darrick J. Wong
2023-07-20 1:50 ` Shiyang Ruan
2023-07-29 10:01 ` Shiyang Ruan
2023-07-29 15:15 ` Darrick J. Wong
2023-07-29 15:15 ` Darrick J. Wong
2023-07-31 9:36 ` Shiyang Ruan
2023-08-01 3:25 ` Darrick J. Wong
2023-08-03 10:44 ` Shiyang Ruan
2023-08-08 0:31 ` Dan Williams
2023-08-23 8:36 ` Shiyang Ruan
2023-08-23 8:17 ` [PATCH v13] mm, pmem, xfs: Introduce MF_MEM_PRE_REMOVE " Shiyang Ruan
2023-08-23 23:36 ` Darrick J. Wong
2023-08-24 9:41 ` Shiyang Ruan
2023-08-24 23:57 ` Darrick J. Wong
2023-08-25 3:52 ` Shiyang Ruan
2023-08-26 0:17 ` Darrick J. Wong
2023-08-28 6:57 ` [PATCH v14] " Shiyang Ruan
2023-08-30 15:34 ` Darrick J. Wong
2023-09-27 8:17 ` Dan Williams
2023-09-27 9:18 ` Shiyang Ruan
2023-09-28 10:32 ` [PATCH v15] " Shiyang Ruan
2023-09-29 18:31 ` Dan Williams
2023-10-01 1:43 ` kernel test robot
2023-10-02 11:57 ` Shiyang Ruan
2023-10-20 9:56 ` Chandan Babu R
2023-10-20 15:40 ` Darrick J. Wong
2023-10-23 6:40 ` Chandan Babu R
2023-10-23 7:26 ` Shiyang Ruan
2023-10-23 12:21 ` Chandan Babu R
2023-10-23 7:20 ` [PATCH v15.1] " Shiyang Ruan
2024-01-11 22:24 ` [PATCH v12 0/2] mm, pmem, xfs: Introduce MF_MEM_REMOVE " Bill O'Donnell
2024-01-12 1:56 ` Shiyang Ruan
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=20230629081651.253626-2-ruansy.fnst@fujitsu.com \
--to=ruansy.fnst@fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=willy@infradead.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 read-only IMAP folder(s) and NNTP newsgroup(s).