Skip to content

Commit 8028411

Browse files
author
Darrick J. Wong
committed
xfs: move xfs_bmap_defer_add to xfs_bmap_item.c
Move the code that adds the incore xfs_bmap_item deferred work data to a transaction live with the BUI log item code. This means that the file mapping code no longer has to know about the inner workings of the BUI log items. As a consequence, we can hide the _get_group helper. Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent 5d3d0a6 commit 8028411

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

fs/xfs/libxfs/xfs_bmap.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "xfs_icache.h"
3838
#include "xfs_iomap.h"
3939
#include "xfs_health.h"
40+
#include "xfs_bmap_item.h"
4041

4142
struct kmem_cache *xfs_bmap_intent_cache;
4243

@@ -6198,10 +6199,7 @@ __xfs_bmap_add(
61986199
bi->bi_whichfork = whichfork;
61996200
bi->bi_bmap = *bmap;
62006201

6201-
trace_xfs_bmap_defer(bi);
6202-
6203-
xfs_bmap_update_get_group(tp->t_mountp, bi);
6204-
xfs_defer_add(tp, &bi->bi_list, &xfs_bmap_update_defer_type);
6202+
xfs_bmap_defer_add(tp, bi);
62056203
return 0;
62066204
}
62076205

fs/xfs/libxfs/xfs_bmap.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,6 @@ struct xfs_bmap_intent {
245245
struct xfs_bmbt_irec bi_bmap;
246246
};
247247

248-
void xfs_bmap_update_get_group(struct xfs_mount *mp,
249-
struct xfs_bmap_intent *bi);
250-
251248
int xfs_bmap_finish_one(struct xfs_trans *tp, struct xfs_bmap_intent *bi);
252249
void xfs_bmap_map_extent(struct xfs_trans *tp, struct xfs_inode *ip,
253250
struct xfs_bmbt_irec *imap);

fs/xfs/xfs_bmap_item.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "xfs_log_priv.h"
2626
#include "xfs_log_recover.h"
2727
#include "xfs_ag.h"
28+
#include "xfs_trace.h"
2829

2930
struct kmem_cache *xfs_bui_cache;
3031
struct kmem_cache *xfs_bud_cache;
@@ -316,7 +317,7 @@ xfs_bmap_update_create_done(
316317
}
317318

318319
/* Take a passive ref to the AG containing the space we're mapping. */
319-
void
320+
static inline void
320321
xfs_bmap_update_get_group(
321322
struct xfs_mount *mp,
322323
struct xfs_bmap_intent *bi)
@@ -335,6 +336,18 @@ xfs_bmap_update_get_group(
335336
bi->bi_pag = xfs_perag_intent_get(mp, agno);
336337
}
337338

339+
/* Add this deferred BUI to the transaction. */
340+
void
341+
xfs_bmap_defer_add(
342+
struct xfs_trans *tp,
343+
struct xfs_bmap_intent *bi)
344+
{
345+
trace_xfs_bmap_defer(bi);
346+
347+
xfs_bmap_update_get_group(tp->t_mountp, bi);
348+
xfs_defer_add(tp, &bi->bi_list, &xfs_bmap_update_defer_type);
349+
}
350+
338351
/* Release a passive AG ref after finishing mapping work. */
339352
static inline void
340353
xfs_bmap_update_put_group(

fs/xfs/xfs_bmap_item.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,8 @@ struct xfs_bud_log_item {
6868
extern struct kmem_cache *xfs_bui_cache;
6969
extern struct kmem_cache *xfs_bud_cache;
7070

71+
struct xfs_bmap_intent;
72+
73+
void xfs_bmap_defer_add(struct xfs_trans *tp, struct xfs_bmap_intent *bi);
74+
7175
#endif /* __XFS_BMAP_ITEM_H__ */

0 commit comments

Comments
 (0)