Skip to content

Commit 6d33523

Browse files
author
Darrick J. Wong
committed
xfs: exchange-range for repairs is no longer dynamic
The atomic file exchange-range functionality is now a permanent filesystem feature instead of a dynamic log-incompat feature. It cannot be turned on at runtime, so we no longer need the XCHK_FSGATES flags and whatnot that supported it. Remove the flag and the enable function, and move the xfs_has_exchange_range checks to the start of the repair functions. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent b44bfc0 commit 6d33523

File tree

10 files changed

+25
-45
lines changed

10 files changed

+25
-45
lines changed

fs/xfs/scrub/attr_repair.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,6 +1630,9 @@ xrep_xattr(
16301630
/* The rmapbt is required to reap the old attr fork. */
16311631
if (!xfs_has_rmapbt(sc->mp))
16321632
return -EOPNOTSUPP;
1633+
/* We require atomic file exchange range to rebuild anything. */
1634+
if (!xfs_has_exchange_range(sc->mp))
1635+
return -EOPNOTSUPP;
16331636

16341637
error = xrep_xattr_setup_scan(sc, &rx);
16351638
if (error)

fs/xfs/scrub/dir_repair.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1993,6 +1993,9 @@ xrep_directory(
19931993
/* The rmapbt is required to reap the old data fork. */
19941994
if (!xfs_has_rmapbt(sc->mp))
19951995
return -EOPNOTSUPP;
1996+
/* We require atomic file exchange range to rebuild anything. */
1997+
if (!xfs_has_exchange_range(sc->mp))
1998+
return -EOPNOTSUPP;
19961999

19972000
error = xrep_dir_setup_scan(rd);
19982001
if (error)

fs/xfs/scrub/parent_repair.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,10 +1571,14 @@ xrep_parent(
15711571
/*
15721572
* When the parent pointers feature is enabled, repairs are committed
15731573
* by atomically committing a new xattr structure and reaping the old
1574-
* attr fork. Reaping requires rmap to be enabled.
1574+
* attr fork. Reaping requires rmap and exchange-range to be enabled.
15751575
*/
1576-
if (xfs_has_parent(sc->mp) && !xfs_has_rmapbt(sc->mp))
1577-
return -EOPNOTSUPP;
1576+
if (xfs_has_parent(sc->mp)) {
1577+
if (!xfs_has_rmapbt(sc->mp))
1578+
return -EOPNOTSUPP;
1579+
if (!xfs_has_exchange_range(sc->mp))
1580+
return -EOPNOTSUPP;
1581+
}
15781582

15791583
error = xrep_parent_setup_scan(rp);
15801584
if (error)

fs/xfs/scrub/rtsummary_repair.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,7 @@ xrep_setup_rtsummary(
6262
return -EOPNOTSUPP;
6363

6464
rts->resblks += blocks;
65-
66-
/*
67-
* Grab support for atomic file content exchanges before we allocate
68-
* any transactions or grab ILOCKs.
69-
*/
70-
return xrep_tempexch_enable(sc);
65+
return 0;
7166
}
7267

7368
static int
@@ -111,6 +106,9 @@ xrep_rtsummary(
111106
/* We require the rmapbt to rebuild anything. */
112107
if (!xfs_has_rmapbt(mp))
113108
return -EOPNOTSUPP;
109+
/* We require atomic file exchange range to rebuild anything. */
110+
if (!xfs_has_exchange_range(mp))
111+
return -EOPNOTSUPP;
114112

115113
/* Walk away if we disagree on the size of the rt bitmap. */
116114
if (rts->rbmblocks != mp->m_sb.sb_rbmblocks)

fs/xfs/scrub/scrub.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,14 @@ xchk_probe(
154154

155155
/* Scrub setup and teardown */
156156

157-
#define FSGATES_MASK (XCHK_FSGATES_ALL | XREP_FSGATES_ALL)
158157
static inline void
159158
xchk_fsgates_disable(
160159
struct xfs_scrub *sc)
161160
{
162-
if (!(sc->flags & FSGATES_MASK))
161+
if (!(sc->flags & XCHK_FSGATES_ALL))
163162
return;
164163

165-
trace_xchk_fsgates_disable(sc, sc->flags & FSGATES_MASK);
164+
trace_xchk_fsgates_disable(sc, sc->flags & XCHK_FSGATES_ALL);
166165

167166
if (sc->flags & XCHK_FSGATES_DRAIN)
168167
xfs_drain_wait_disable();
@@ -176,9 +175,8 @@ xchk_fsgates_disable(
176175
if (sc->flags & XCHK_FSGATES_RMAP)
177176
xfs_rmap_hook_disable();
178177

179-
sc->flags &= ~FSGATES_MASK;
178+
sc->flags &= ~XCHK_FSGATES_ALL;
180179
}
181-
#undef FSGATES_MASK
182180

183181
/* Free the resources associated with a scrub subtype. */
184182
void

fs/xfs/scrub/scrub.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ struct xfs_scrub {
188188
#define XCHK_FSGATES_QUOTA (1U << 4) /* quota live update enabled */
189189
#define XCHK_FSGATES_DIRENTS (1U << 5) /* directory live update enabled */
190190
#define XCHK_FSGATES_RMAP (1U << 6) /* rmapbt live update enabled */
191-
#define XREP_FSGATES_EXCHANGE_RANGE (1U << 29) /* uses file content exchange */
192191
#define XREP_RESET_PERAG_RESV (1U << 30) /* must reset AG space reservation */
193192
#define XREP_ALREADY_FIXED (1U << 31) /* checking our repair work */
194193

@@ -203,12 +202,6 @@ struct xfs_scrub {
203202
XCHK_FSGATES_DIRENTS | \
204203
XCHK_FSGATES_RMAP)
205204

206-
/*
207-
* The sole XREP_FSGATES* flag reflects a log intent item that is protected
208-
* by a log-incompat feature flag. No code patching in use here.
209-
*/
210-
#define XREP_FSGATES_ALL (XREP_FSGATES_EXCHANGE_RANGE)
211-
212205
struct xfs_scrub_subord {
213206
struct xfs_scrub sc;
214207
struct xfs_scrub *parent_sc;

fs/xfs/scrub/symlink_repair.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,9 @@ xrep_symlink(
490490
/* The rmapbt is required to reap the old data fork. */
491491
if (!xfs_has_rmapbt(sc->mp))
492492
return -EOPNOTSUPP;
493+
/* We require atomic file exchange range to rebuild anything. */
494+
if (!xfs_has_exchange_range(sc->mp))
495+
return -EOPNOTSUPP;
493496

494497
ASSERT(sc->ilock_flags & XFS_ILOCK_EXCL);
495498

fs/xfs/scrub/tempexch.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ struct xrep_tempexch {
1111
struct xfs_exchmaps_req req;
1212
};
1313

14-
int xrep_tempexch_enable(struct xfs_scrub *sc);
1514
int xrep_tempexch_trans_reserve(struct xfs_scrub *sc, int whichfork,
1615
struct xrep_tempexch *ti);
1716
int xrep_tempexch_trans_alloc(struct xfs_scrub *sc, int whichfork,

fs/xfs/scrub/tempfile.c

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -486,23 +486,6 @@ xrep_tempfile_roll_trans(
486486
return 0;
487487
}
488488

489-
/* Enable file content exchanges. */
490-
int
491-
xrep_tempexch_enable(
492-
struct xfs_scrub *sc)
493-
{
494-
if (sc->flags & XREP_FSGATES_EXCHANGE_RANGE)
495-
return 0;
496-
497-
if (!xfs_has_exchange_range(sc->mp))
498-
return -EOPNOTSUPP;
499-
500-
trace_xchk_fsgates_enable(sc, XREP_FSGATES_EXCHANGE_RANGE);
501-
502-
sc->flags |= XREP_FSGATES_EXCHANGE_RANGE;
503-
return 0;
504-
}
505-
506489
/*
507490
* Fill out the mapping exchange request in preparation for atomically
508491
* committing the contents of a metadata file that we've rebuilt in the temp
@@ -745,6 +728,7 @@ xrep_tempexch_trans_alloc(
745728
int error;
746729

747730
ASSERT(sc->tp == NULL);
731+
ASSERT(xfs_has_exchange_range(sc->mp));
748732

749733
error = xrep_tempexch_prep_request(sc, whichfork, tx);
750734
if (error)
@@ -757,10 +741,6 @@ xrep_tempexch_trans_alloc(
757741
if (xfs_has_lazysbcount(sc->mp))
758742
flags |= XFS_TRANS_RES_FDBLKS;
759743

760-
error = xrep_tempexch_enable(sc);
761-
if (error)
762-
return error;
763-
764744
error = xfs_trans_alloc(sc->mp, &M_RES(sc->mp)->tr_itruncate,
765745
tx->req.resblks, 0, flags, &sc->tp);
766746
if (error)
@@ -785,7 +765,7 @@ xrep_tempexch_contents(
785765
{
786766
int error;
787767

788-
ASSERT(sc->flags & XREP_FSGATES_EXCHANGE_RANGE);
768+
ASSERT(xfs_has_exchange_range(sc->mp));
789769

790770
xfs_exchange_mappings(sc->tp, &tx->req);
791771
error = xfs_defer_finish(&sc->tp);

fs/xfs/scrub/trace.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BARRIER);
122122
{ XCHK_FSGATES_QUOTA, "fsgates_quota" }, \
123123
{ XCHK_FSGATES_DIRENTS, "fsgates_dirents" }, \
124124
{ XCHK_FSGATES_RMAP, "fsgates_rmap" }, \
125-
{ XREP_FSGATES_EXCHANGE_RANGE, "fsgates_exchrange" }, \
126125
{ XREP_RESET_PERAG_RESV, "reset_perag_resv" }, \
127126
{ XREP_ALREADY_FIXED, "already_fixed" }
128127

0 commit comments

Comments
 (0)