Skip to content

Commit 3c90c01

Browse files
iridesChandan Babu R
authored andcommitted
xfs: correct calculation for agend and blockcount
The agend should be "start + length - 1", then, blockcount should be "end + 1 - start". Correct 2 calculation mistakes. Also, rename "agend" to "range_agend" because it's not the end of the AG per se; it's the end of the dead region within an AG's agblock space. Fixes: 5cf32f6 ("xfs: fix the calculation for "end" and "length"") Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com> Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
1 parent fa543e6 commit 3c90c01

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/xfs/xfs_notify_failure.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ xfs_dax_notify_ddev_failure(
126126
struct xfs_rmap_irec ri_low = { };
127127
struct xfs_rmap_irec ri_high;
128128
struct xfs_agf *agf;
129-
xfs_agblock_t agend;
130129
struct xfs_perag *pag;
130+
xfs_agblock_t range_agend;
131131

132132
pag = xfs_perag_get(mp, agno);
133133
error = xfs_alloc_read_agf(pag, tp, 0, &agf_bp);
@@ -148,10 +148,10 @@ xfs_dax_notify_ddev_failure(
148148
ri_high.rm_startblock = XFS_FSB_TO_AGBNO(mp, end_fsbno);
149149

150150
agf = agf_bp->b_addr;
151-
agend = min(be32_to_cpu(agf->agf_length),
151+
range_agend = min(be32_to_cpu(agf->agf_length) - 1,
152152
ri_high.rm_startblock);
153153
notify.startblock = ri_low.rm_startblock;
154-
notify.blockcount = agend - ri_low.rm_startblock;
154+
notify.blockcount = range_agend + 1 - ri_low.rm_startblock;
155155

156156
error = xfs_rmap_query_range(cur, &ri_low, &ri_high,
157157
xfs_dax_failure_fn, &notify);

0 commit comments

Comments
 (0)