mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 14:11:52 +00:00
xfs: add log item flags to indicate intents
We currently have a couple of helper functions that try to infer whether the log item is an intent or intent done item from the combinations of operations it supports. This is incredibly fragile and not very efficient as it requires checking specific combinations of ops. We need to be able to identify intent and intent done items quickly and easily in upcoming patches, so simply add intent and intent done type flags to the log item ops flags. These are static flags to begin with, so intent items should have been typed like this from the start. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:
parent
5ddd658ea8
commit
f5b81200b6
@ -204,7 +204,8 @@ xfs_bud_item_release(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct xfs_item_ops xfs_bud_item_ops = {
|
static const struct xfs_item_ops xfs_bud_item_ops = {
|
||||||
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED,
|
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED |
|
||||||
|
XFS_ITEM_INTENT_DONE,
|
||||||
.iop_size = xfs_bud_item_size,
|
.iop_size = xfs_bud_item_size,
|
||||||
.iop_format = xfs_bud_item_format,
|
.iop_format = xfs_bud_item_format,
|
||||||
.iop_release = xfs_bud_item_release,
|
.iop_release = xfs_bud_item_release,
|
||||||
@ -588,6 +589,7 @@ xfs_bui_item_relog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct xfs_item_ops xfs_bui_item_ops = {
|
static const struct xfs_item_ops xfs_bui_item_ops = {
|
||||||
|
.flags = XFS_ITEM_INTENT,
|
||||||
.iop_size = xfs_bui_item_size,
|
.iop_size = xfs_bui_item_size,
|
||||||
.iop_format = xfs_bui_item_format,
|
.iop_format = xfs_bui_item_format,
|
||||||
.iop_unpin = xfs_bui_item_unpin,
|
.iop_unpin = xfs_bui_item_unpin,
|
||||||
|
@ -307,7 +307,8 @@ xfs_efd_item_release(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct xfs_item_ops xfs_efd_item_ops = {
|
static const struct xfs_item_ops xfs_efd_item_ops = {
|
||||||
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED,
|
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED |
|
||||||
|
XFS_ITEM_INTENT_DONE,
|
||||||
.iop_size = xfs_efd_item_size,
|
.iop_size = xfs_efd_item_size,
|
||||||
.iop_format = xfs_efd_item_format,
|
.iop_format = xfs_efd_item_format,
|
||||||
.iop_release = xfs_efd_item_release,
|
.iop_release = xfs_efd_item_release,
|
||||||
@ -688,6 +689,7 @@ xfs_efi_item_relog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct xfs_item_ops xfs_efi_item_ops = {
|
static const struct xfs_item_ops xfs_efi_item_ops = {
|
||||||
|
.flags = XFS_ITEM_INTENT,
|
||||||
.iop_size = xfs_efi_item_size,
|
.iop_size = xfs_efi_item_size,
|
||||||
.iop_format = xfs_efi_item_format,
|
.iop_format = xfs_efi_item_format,
|
||||||
.iop_unpin = xfs_efi_item_unpin,
|
.iop_unpin = xfs_efi_item_unpin,
|
||||||
|
@ -210,7 +210,8 @@ xfs_cud_item_release(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct xfs_item_ops xfs_cud_item_ops = {
|
static const struct xfs_item_ops xfs_cud_item_ops = {
|
||||||
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED,
|
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED |
|
||||||
|
XFS_ITEM_INTENT_DONE,
|
||||||
.iop_size = xfs_cud_item_size,
|
.iop_size = xfs_cud_item_size,
|
||||||
.iop_format = xfs_cud_item_format,
|
.iop_format = xfs_cud_item_format,
|
||||||
.iop_release = xfs_cud_item_release,
|
.iop_release = xfs_cud_item_release,
|
||||||
@ -602,6 +603,7 @@ xfs_cui_item_relog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct xfs_item_ops xfs_cui_item_ops = {
|
static const struct xfs_item_ops xfs_cui_item_ops = {
|
||||||
|
.flags = XFS_ITEM_INTENT,
|
||||||
.iop_size = xfs_cui_item_size,
|
.iop_size = xfs_cui_item_size,
|
||||||
.iop_format = xfs_cui_item_format,
|
.iop_format = xfs_cui_item_format,
|
||||||
.iop_unpin = xfs_cui_item_unpin,
|
.iop_unpin = xfs_cui_item_unpin,
|
||||||
|
@ -233,7 +233,8 @@ xfs_rud_item_release(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct xfs_item_ops xfs_rud_item_ops = {
|
static const struct xfs_item_ops xfs_rud_item_ops = {
|
||||||
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED,
|
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED |
|
||||||
|
XFS_ITEM_INTENT_DONE,
|
||||||
.iop_size = xfs_rud_item_size,
|
.iop_size = xfs_rud_item_size,
|
||||||
.iop_format = xfs_rud_item_format,
|
.iop_format = xfs_rud_item_format,
|
||||||
.iop_release = xfs_rud_item_release,
|
.iop_release = xfs_rud_item_release,
|
||||||
@ -632,6 +633,7 @@ xfs_rui_item_relog(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct xfs_item_ops xfs_rui_item_ops = {
|
static const struct xfs_item_ops xfs_rui_item_ops = {
|
||||||
|
.flags = XFS_ITEM_INTENT,
|
||||||
.iop_size = xfs_rui_item_size,
|
.iop_size = xfs_rui_item_size,
|
||||||
.iop_format = xfs_rui_item_format,
|
.iop_format = xfs_rui_item_format,
|
||||||
.iop_unpin = xfs_rui_item_unpin,
|
.iop_unpin = xfs_rui_item_unpin,
|
||||||
|
@ -80,28 +80,29 @@ struct xfs_item_ops {
|
|||||||
struct xfs_trans *tp);
|
struct xfs_trans *tp);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Is this log item a deferred action intent? */
|
/*
|
||||||
|
* Log item ops flags
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* Release the log item when the journal commits instead of inserting into the
|
||||||
|
* AIL for writeback tracking and/or log tail pinning.
|
||||||
|
*/
|
||||||
|
#define XFS_ITEM_RELEASE_WHEN_COMMITTED (1 << 0)
|
||||||
|
#define XFS_ITEM_INTENT (1 << 1)
|
||||||
|
#define XFS_ITEM_INTENT_DONE (1 << 2)
|
||||||
|
|
||||||
static inline bool
|
static inline bool
|
||||||
xlog_item_is_intent(struct xfs_log_item *lip)
|
xlog_item_is_intent(struct xfs_log_item *lip)
|
||||||
{
|
{
|
||||||
return lip->li_ops->iop_recover != NULL &&
|
return lip->li_ops->flags & XFS_ITEM_INTENT;
|
||||||
lip->li_ops->iop_match != NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is this a log intent-done item? */
|
|
||||||
static inline bool
|
static inline bool
|
||||||
xlog_item_is_intent_done(struct xfs_log_item *lip)
|
xlog_item_is_intent_done(struct xfs_log_item *lip)
|
||||||
{
|
{
|
||||||
return lip->li_ops->iop_unpin == NULL &&
|
return lip->li_ops->flags & XFS_ITEM_INTENT_DONE;
|
||||||
lip->li_ops->iop_push == NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Release the log item as soon as committed. This is for items just logging
|
|
||||||
* intents that never need to be written back in place.
|
|
||||||
*/
|
|
||||||
#define XFS_ITEM_RELEASE_WHEN_COMMITTED (1 << 0)
|
|
||||||
|
|
||||||
void xfs_log_item_init(struct xfs_mount *mp, struct xfs_log_item *item,
|
void xfs_log_item_init(struct xfs_mount *mp, struct xfs_log_item *item,
|
||||||
int type, const struct xfs_item_ops *ops);
|
int type, const struct xfs_item_ops *ops);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user