From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-api@vger.kernel.org
Subject: [PATCH 08/21] xfs: enable xlog users to toggle atomic extent swapping
Date: Fri, 30 Dec 2022 14:13:56 -0800 [thread overview]
Message-ID: <167243843639.699466.9221823995188278604.stgit@magnolia> (raw)
In-Reply-To: <167243843494.699466.5163281976943635014.stgit@magnolia>
From: Darrick J. Wong <djwong@kernel.org>
Plumb the necessary bits into the xlog code so that higher level callers
can enable the atomic extent swapping feature and have it clear
automatically when possible.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
fs/xfs/xfs_log.c | 13 +++++++++++++
fs/xfs/xfs_log.h | 1 +
fs/xfs/xfs_log_priv.h | 1 +
3 files changed, 15 insertions(+)
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index a0ef09addc84..37e85c1bb913 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1501,11 +1501,17 @@ xlog_clear_incompat(
if (down_write_trylock(&log->l_incompat_xattrs))
incompat_mask |= XFS_SB_FEAT_INCOMPAT_LOG_XATTRS;
+ if (down_write_trylock(&log->l_incompat_swapext))
+ incompat_mask |= XFS_SB_FEAT_INCOMPAT_LOG_SWAPEXT;
+
if (!incompat_mask)
return;
xfs_clear_incompat_log_features(mp, incompat_mask);
+ if (incompat_mask & XFS_SB_FEAT_INCOMPAT_LOG_SWAPEXT)
+ up_write(&log->l_incompat_swapext);
+
if (incompat_mask & XFS_SB_FEAT_INCOMPAT_LOG_XATTRS)
up_write(&log->l_incompat_xattrs);
}
@@ -1625,6 +1631,7 @@ xlog_alloc_log(
log->l_sectBBsize = 1 << log2_size;
init_rwsem(&log->l_incompat_xattrs);
+ init_rwsem(&log->l_incompat_swapext);
xlog_get_iclog_buffer_size(mp, log);
@@ -3922,6 +3929,9 @@ xlog_use_incompat_feat(
case XLOG_INCOMPAT_FEAT_XATTRS:
down_read(&log->l_incompat_xattrs);
break;
+ case XLOG_INCOMPAT_FEAT_SWAPEXT:
+ down_read(&log->l_incompat_swapext);
+ break;
}
}
@@ -3935,5 +3945,8 @@ xlog_drop_incompat_feat(
case XLOG_INCOMPAT_FEAT_XATTRS:
up_read(&log->l_incompat_xattrs);
break;
+ case XLOG_INCOMPAT_FEAT_SWAPEXT:
+ up_read(&log->l_incompat_swapext);
+ break;
}
}
diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
index d187f6445909..30bdbf8ee25c 100644
--- a/fs/xfs/xfs_log.h
+++ b/fs/xfs/xfs_log.h
@@ -161,6 +161,7 @@ bool xlog_force_shutdown(struct xlog *log, uint32_t shutdown_flags);
enum xlog_incompat_feat {
XLOG_INCOMPAT_FEAT_XATTRS = XFS_SB_FEAT_INCOMPAT_LOG_XATTRS,
+ XLOG_INCOMPAT_FEAT_SWAPEXT = XFS_SB_FEAT_INCOMPAT_LOG_SWAPEXT
};
void xlog_use_incompat_feat(struct xlog *log, enum xlog_incompat_feat what);
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index a13b5b6b744d..6cbee6996de5 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -448,6 +448,7 @@ struct xlog {
/* Users of log incompat features should take a read lock. */
struct rw_semaphore l_incompat_xattrs;
+ struct rw_semaphore l_incompat_swapext;
};
/*
next prev parent reply other threads:[~2022-12-30 23:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Y69Unb7KRM5awJoV@magnolia>
2022-12-30 22:13 ` [PATCHSET v24.0 00/21] xfs: atomic file updates Darrick J. Wong
2022-12-30 22:13 ` [PATCH 02/21] xfs: create a new helper to return a file's allocation unit Darrick J. Wong
2022-12-30 22:13 ` [PATCH 05/21] xfs: create a log incompat flag for atomic extent swapping Darrick J. Wong
2022-12-30 22:13 ` [PATCH 01/21] vfs: introduce new file range exchange ioctl Darrick J. Wong
2022-12-30 22:13 ` [PATCH 04/21] xfs: parameterize all the incompat log feature helpers Darrick J. Wong
2022-12-30 22:13 ` [PATCH 03/21] xfs: refactor non-power-of-two alignment checks Darrick J. Wong
2022-12-30 22:13 ` [PATCH 06/21] xfs: introduce a swap-extent log intent item Darrick J. Wong
2022-12-30 22:13 ` Darrick J. Wong [this message]
2022-12-30 22:13 ` [PATCH 07/21] xfs: create deferred log items for extent swapping Darrick J. Wong
2022-12-30 22:13 ` [PATCH 10/21] xfs: add error injection to test swapext recovery Darrick J. Wong
2022-12-30 22:13 ` [PATCH 11/21] xfs: port xfs_swap_extents_rmap to our new code Darrick J. Wong
2022-12-30 22:13 ` [PATCH 09/21] xfs: add a ->xchg_file_range handler Darrick J. Wong
2022-12-30 22:13 ` [PATCH 17/21] xfs: condense directories after an atomic swap Darrick J. Wong
2022-12-30 22:13 ` [PATCH 14/21] xfs: allow xfs_swap_range to use older extent swap algorithms Darrick J. Wong
2022-12-30 22:13 ` [PATCH 18/21] xfs: condense symbolic links after an atomic swap Darrick J. Wong
2022-12-30 22:13 ` [PATCH 12/21] xfs: consolidate all of the xfs_swap_extent_forks code Darrick J. Wong
2022-12-30 22:13 ` [PATCH 15/21] xfs: remove old swap extents implementation Darrick J. Wong
2022-12-30 22:13 ` [PATCH 13/21] xfs: port xfs_swap_extent_forks to use xfs_swapext_req Darrick J. Wong
2022-12-30 22:13 ` [PATCH 16/21] xfs: condense extended attributes after an atomic swap Darrick J. Wong
2022-12-30 22:13 ` [PATCH 20/21] xfs: support non-power-of-two rtextsize with exchange-range Darrick J. Wong
2022-12-30 22:13 ` [PATCH 21/21] xfs: enable atomic swapext feature Darrick J. Wong
2022-12-30 22:13 ` [PATCH 19/21] xfs: make atomic extent swapping support realtime files Darrick J. Wong
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=167243843639.699466.9221823995188278604.stgit@magnolia \
--to=djwong@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@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