Skip to content

Commit 4136e38

Browse files
Darrick J. Wongdchinner
authored andcommitted
xfs: put attr[id] log item cache init with the others
Initialize and destroy the xattr log item caches in the same places that we do all the other log item caches. Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Allison Henderson <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Signed-off-by: Dave Chinner <[email protected]>
1 parent 500a512 commit 4136e38

File tree

6 files changed

+25
-52
lines changed

6 files changed

+25
-52
lines changed

fs/xfs/libxfs/xfs_attr.c

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#include "xfs_attr_item.h"
2828
#include "xfs_log.h"
2929

30-
struct kmem_cache *xfs_attri_cache;
31-
struct kmem_cache *xfs_attrd_cache;
3230
struct kmem_cache *xfs_attr_intent_cache;
3331

3432
/*
@@ -1113,40 +1111,6 @@ xfs_attr_set(
11131111
goto out_unlock;
11141112
}
11151113

1116-
int __init
1117-
xfs_attri_init_cache(void)
1118-
{
1119-
xfs_attri_cache = kmem_cache_create("xfs_attri",
1120-
sizeof(struct xfs_attri_log_item),
1121-
0, 0, NULL);
1122-
1123-
return xfs_attri_cache != NULL ? 0 : -ENOMEM;
1124-
}
1125-
1126-
void
1127-
xfs_attri_destroy_cache(void)
1128-
{
1129-
kmem_cache_destroy(xfs_attri_cache);
1130-
xfs_attri_cache = NULL;
1131-
}
1132-
1133-
int __init
1134-
xfs_attrd_init_cache(void)
1135-
{
1136-
xfs_attrd_cache = kmem_cache_create("xfs_attrd",
1137-
sizeof(struct xfs_attrd_log_item),
1138-
0, 0, NULL);
1139-
1140-
return xfs_attrd_cache != NULL ? 0 : -ENOMEM;
1141-
}
1142-
1143-
void
1144-
xfs_attrd_destroy_cache(void)
1145-
{
1146-
kmem_cache_destroy(xfs_attrd_cache);
1147-
xfs_attrd_cache = NULL;
1148-
}
1149-
11501114
/*========================================================================
11511115
* External routines when attribute list is inside the inode
11521116
*========================================================================*/

fs/xfs/libxfs/xfs_attr.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -558,14 +558,6 @@ int xfs_attr_calc_size(struct xfs_da_args *args, int *local);
558558
void xfs_init_attr_trans(struct xfs_da_args *args, struct xfs_trans_res *tres,
559559
unsigned int *total);
560560

561-
extern struct kmem_cache *xfs_attri_cache;
562-
extern struct kmem_cache *xfs_attrd_cache;
563-
564-
int __init xfs_attri_init_cache(void);
565-
void xfs_attri_destroy_cache(void);
566-
int __init xfs_attrd_init_cache(void);
567-
void xfs_attrd_destroy_cache(void);
568-
569561
/*
570562
* Check to see if the attr should be upgraded from non-existent or shortform to
571563
* single-leaf-block attribute list.

fs/xfs/libxfs/xfs_defer.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -871,12 +871,6 @@ xfs_defer_init_item_caches(void)
871871
if (error)
872872
goto err;
873873
error = xfs_extfree_intent_init_cache();
874-
if (error)
875-
goto err;
876-
error = xfs_attri_init_cache();
877-
if (error)
878-
goto err;
879-
error = xfs_attrd_init_cache();
880874
if (error)
881875
goto err;
882876
error = xfs_attr_intent_init_cache();
@@ -893,8 +887,6 @@ void
893887
xfs_defer_destroy_item_caches(void)
894888
{
895889
xfs_attr_intent_destroy_cache();
896-
xfs_attri_destroy_cache();
897-
xfs_attrd_destroy_cache();
898890
xfs_extfree_intent_destroy_cache();
899891
xfs_bmap_intent_destroy_cache();
900892
xfs_refcount_intent_destroy_cache();

fs/xfs/xfs_attr_item.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#include "xfs_log_priv.h"
3030
#include "xfs_log_recover.h"
3131

32+
struct kmem_cache *xfs_attri_cache;
33+
struct kmem_cache *xfs_attrd_cache;
34+
3235
static const struct xfs_item_ops xfs_attri_item_ops;
3336
static const struct xfs_item_ops xfs_attrd_item_ops;
3437
static struct xfs_attrd_log_item *xfs_trans_get_attrd(struct xfs_trans *tp,

fs/xfs/xfs_attr_item.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,7 @@ struct xfs_attrd_log_item {
4343
struct xfs_attrd_log_format attrd_format;
4444
};
4545

46+
extern struct kmem_cache *xfs_attri_cache;
47+
extern struct kmem_cache *xfs_attrd_cache;
48+
4649
#endif /* __XFS_ATTR_ITEM_H__ */

fs/xfs/xfs_super.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "xfs_pwork.h"
3939
#include "xfs_ag.h"
4040
#include "xfs_defer.h"
41+
#include "xfs_attr_item.h"
4142

4243
#include <linux/magic.h>
4344
#include <linux/fs_context.h>
@@ -2083,8 +2084,24 @@ xfs_init_caches(void)
20832084
if (!xfs_bui_cache)
20842085
goto out_destroy_bud_cache;
20852086

2087+
xfs_attrd_cache = kmem_cache_create("xfs_attrd_item",
2088+
sizeof(struct xfs_attrd_log_item),
2089+
0, 0, NULL);
2090+
if (!xfs_attrd_cache)
2091+
goto out_destroy_bui_cache;
2092+
2093+
xfs_attri_cache = kmem_cache_create("xfs_attri_item",
2094+
sizeof(struct xfs_attri_log_item),
2095+
0, 0, NULL);
2096+
if (!xfs_attri_cache)
2097+
goto out_destroy_attrd_cache;
2098+
20862099
return 0;
20872100

2101+
out_destroy_attrd_cache:
2102+
kmem_cache_destroy(xfs_attrd_cache);
2103+
out_destroy_bui_cache:
2104+
kmem_cache_destroy(xfs_bui_cache);
20882105
out_destroy_bud_cache:
20892106
kmem_cache_destroy(xfs_bud_cache);
20902107
out_destroy_cui_cache:
@@ -2131,6 +2148,8 @@ xfs_destroy_caches(void)
21312148
* destroy caches.
21322149
*/
21332150
rcu_barrier();
2151+
kmem_cache_destroy(xfs_attri_cache);
2152+
kmem_cache_destroy(xfs_attrd_cache);
21342153
kmem_cache_destroy(xfs_bui_cache);
21352154
kmem_cache_destroy(xfs_bud_cache);
21362155
kmem_cache_destroy(xfs_cui_cache);

0 commit comments

Comments
 (0)