Skip to content

Commit c23ab60

Browse files
Dave Chinnerdchinner
authored andcommitted
xfs: add log item method to return related intents
To apply a whiteout to an intent item when an intent done item is committed, we need to be able to retrieve the intent item from the the intent done item. Add a log item op method for doing this, and wire all the intent done items up to it. Signed-off-by: Dave Chinner <[email protected]> Reviewed-by: Allison Henderson <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Dave Chinner <[email protected]>
1 parent 22b1afc commit c23ab60

File tree

5 files changed

+33
-0
lines changed

5 files changed

+33
-0
lines changed

fs/xfs/xfs_bmap_item.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,20 @@ xfs_bud_item_release(
203203
kmem_cache_free(xfs_bud_cache, budp);
204204
}
205205

206+
static struct xfs_log_item *
207+
xfs_bud_item_intent(
208+
struct xfs_log_item *lip)
209+
{
210+
return &BUD_ITEM(lip)->bud_buip->bui_item;
211+
}
212+
206213
static const struct xfs_item_ops xfs_bud_item_ops = {
207214
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED |
208215
XFS_ITEM_INTENT_DONE,
209216
.iop_size = xfs_bud_item_size,
210217
.iop_format = xfs_bud_item_format,
211218
.iop_release = xfs_bud_item_release,
219+
.iop_intent = xfs_bud_item_intent,
212220
};
213221

214222
static struct xfs_bud_log_item *

fs/xfs/xfs_extfree_item.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,20 @@ xfs_efd_item_release(
306306
xfs_efd_item_free(efdp);
307307
}
308308

309+
static struct xfs_log_item *
310+
xfs_efd_item_intent(
311+
struct xfs_log_item *lip)
312+
{
313+
return &EFD_ITEM(lip)->efd_efip->efi_item;
314+
}
315+
309316
static const struct xfs_item_ops xfs_efd_item_ops = {
310317
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED |
311318
XFS_ITEM_INTENT_DONE,
312319
.iop_size = xfs_efd_item_size,
313320
.iop_format = xfs_efd_item_format,
314321
.iop_release = xfs_efd_item_release,
322+
.iop_intent = xfs_efd_item_intent,
315323
};
316324

317325
/*

fs/xfs/xfs_refcount_item.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,12 +209,20 @@ xfs_cud_item_release(
209209
kmem_cache_free(xfs_cud_cache, cudp);
210210
}
211211

212+
static struct xfs_log_item *
213+
xfs_cud_item_intent(
214+
struct xfs_log_item *lip)
215+
{
216+
return &CUD_ITEM(lip)->cud_cuip->cui_item;
217+
}
218+
212219
static const struct xfs_item_ops xfs_cud_item_ops = {
213220
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED |
214221
XFS_ITEM_INTENT_DONE,
215222
.iop_size = xfs_cud_item_size,
216223
.iop_format = xfs_cud_item_format,
217224
.iop_release = xfs_cud_item_release,
225+
.iop_intent = xfs_cud_item_intent,
218226
};
219227

220228
static struct xfs_cud_log_item *

fs/xfs/xfs_rmap_item.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,20 @@ xfs_rud_item_release(
232232
kmem_cache_free(xfs_rud_cache, rudp);
233233
}
234234

235+
static struct xfs_log_item *
236+
xfs_rud_item_intent(
237+
struct xfs_log_item *lip)
238+
{
239+
return &RUD_ITEM(lip)->rud_ruip->rui_item;
240+
}
241+
235242
static const struct xfs_item_ops xfs_rud_item_ops = {
236243
.flags = XFS_ITEM_RELEASE_WHEN_COMMITTED |
237244
XFS_ITEM_INTENT_DONE,
238245
.iop_size = xfs_rud_item_size,
239246
.iop_format = xfs_rud_item_format,
240247
.iop_release = xfs_rud_item_release,
248+
.iop_intent = xfs_rud_item_intent,
241249
};
242250

243251
static struct xfs_rud_log_item *

fs/xfs/xfs_trans.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ struct xfs_item_ops {
7878
bool (*iop_match)(struct xfs_log_item *item, uint64_t id);
7979
struct xfs_log_item *(*iop_relog)(struct xfs_log_item *intent,
8080
struct xfs_trans *tp);
81+
struct xfs_log_item *(*iop_intent)(struct xfs_log_item *intent_done);
8182
};
8283

8384
/*

0 commit comments

Comments
 (0)