diff options
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r-- | fs/ocfs2/super.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 41bb0197cf4c..7bb83e41581e 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -65,10 +65,13 @@ | |||
65 | #include "uptodate.h" | 65 | #include "uptodate.h" |
66 | #include "ver.h" | 66 | #include "ver.h" |
67 | #include "xattr.h" | 67 | #include "xattr.h" |
68 | #include "quota.h" | ||
68 | 69 | ||
69 | #include "buffer_head_io.h" | 70 | #include "buffer_head_io.h" |
70 | 71 | ||
71 | static struct kmem_cache *ocfs2_inode_cachep = NULL; | 72 | static struct kmem_cache *ocfs2_inode_cachep = NULL; |
73 | struct kmem_cache *ocfs2_dquot_cachep; | ||
74 | struct kmem_cache *ocfs2_qf_chunk_cachep; | ||
72 | 75 | ||
73 | /* OCFS2 needs to schedule several differnt types of work which | 76 | /* OCFS2 needs to schedule several differnt types of work which |
74 | * require cluster locking, disk I/O, recovery waits, etc. Since these | 77 | * require cluster locking, disk I/O, recovery waits, etc. Since these |
@@ -137,6 +140,8 @@ static const struct super_operations ocfs2_sops = { | |||
137 | .put_super = ocfs2_put_super, | 140 | .put_super = ocfs2_put_super, |
138 | .remount_fs = ocfs2_remount, | 141 | .remount_fs = ocfs2_remount, |
139 | .show_options = ocfs2_show_options, | 142 | .show_options = ocfs2_show_options, |
143 | .quota_read = ocfs2_quota_read, | ||
144 | .quota_write = ocfs2_quota_write, | ||
140 | }; | 145 | }; |
141 | 146 | ||
142 | enum { | 147 | enum { |
@@ -1104,6 +1109,7 @@ static int __init ocfs2_init(void) | |||
1104 | 1109 | ||
1105 | ocfs2_set_locking_protocol(); | 1110 | ocfs2_set_locking_protocol(); |
1106 | 1111 | ||
1112 | status = register_quota_format(&ocfs2_quota_format); | ||
1107 | leave: | 1113 | leave: |
1108 | if (status < 0) { | 1114 | if (status < 0) { |
1109 | ocfs2_free_mem_caches(); | 1115 | ocfs2_free_mem_caches(); |
@@ -1127,6 +1133,8 @@ static void __exit ocfs2_exit(void) | |||
1127 | destroy_workqueue(ocfs2_wq); | 1133 | destroy_workqueue(ocfs2_wq); |
1128 | } | 1134 | } |
1129 | 1135 | ||
1136 | unregister_quota_format(&ocfs2_quota_format); | ||
1137 | |||
1130 | debugfs_remove(ocfs2_debugfs_root); | 1138 | debugfs_remove(ocfs2_debugfs_root); |
1131 | 1139 | ||
1132 | ocfs2_free_mem_caches(); | 1140 | ocfs2_free_mem_caches(); |
@@ -1242,8 +1250,27 @@ static int ocfs2_initialize_mem_caches(void) | |||
1242 | (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| | 1250 | (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| |
1243 | SLAB_MEM_SPREAD), | 1251 | SLAB_MEM_SPREAD), |
1244 | ocfs2_inode_init_once); | 1252 | ocfs2_inode_init_once); |
1245 | if (!ocfs2_inode_cachep) | 1253 | ocfs2_dquot_cachep = kmem_cache_create("ocfs2_dquot_cache", |
1254 | sizeof(struct ocfs2_dquot), | ||
1255 | 0, | ||
1256 | (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| | ||
1257 | SLAB_MEM_SPREAD), | ||
1258 | NULL); | ||
1259 | ocfs2_qf_chunk_cachep = kmem_cache_create("ocfs2_qf_chunk_cache", | ||
1260 | sizeof(struct ocfs2_quota_chunk), | ||
1261 | 0, | ||
1262 | (SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD), | ||
1263 | NULL); | ||
1264 | if (!ocfs2_inode_cachep || !ocfs2_dquot_cachep || | ||
1265 | !ocfs2_qf_chunk_cachep) { | ||
1266 | if (ocfs2_inode_cachep) | ||
1267 | kmem_cache_destroy(ocfs2_inode_cachep); | ||
1268 | if (ocfs2_dquot_cachep) | ||
1269 | kmem_cache_destroy(ocfs2_dquot_cachep); | ||
1270 | if (ocfs2_qf_chunk_cachep) | ||
1271 | kmem_cache_destroy(ocfs2_qf_chunk_cachep); | ||
1246 | return -ENOMEM; | 1272 | return -ENOMEM; |
1273 | } | ||
1247 | 1274 | ||
1248 | return 0; | 1275 | return 0; |
1249 | } | 1276 | } |
@@ -1252,8 +1279,15 @@ static void ocfs2_free_mem_caches(void) | |||
1252 | { | 1279 | { |
1253 | if (ocfs2_inode_cachep) | 1280 | if (ocfs2_inode_cachep) |
1254 | kmem_cache_destroy(ocfs2_inode_cachep); | 1281 | kmem_cache_destroy(ocfs2_inode_cachep); |
1255 | |||
1256 | ocfs2_inode_cachep = NULL; | 1282 | ocfs2_inode_cachep = NULL; |
1283 | |||
1284 | if (ocfs2_dquot_cachep) | ||
1285 | kmem_cache_destroy(ocfs2_dquot_cachep); | ||
1286 | ocfs2_dquot_cachep = NULL; | ||
1287 | |||
1288 | if (ocfs2_qf_chunk_cachep) | ||
1289 | kmem_cache_destroy(ocfs2_qf_chunk_cachep); | ||
1290 | ocfs2_qf_chunk_cachep = NULL; | ||
1257 | } | 1291 | } |
1258 | 1292 | ||
1259 | static int ocfs2_get_sector(struct super_block *sb, | 1293 | static int ocfs2_get_sector(struct super_block *sb, |