aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/super.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-08-25 13:56:50 -0400
committerMark Fasheh <mfasheh@suse.com>2009-01-05 11:40:23 -0500
commit9e33d69f553aaf11377307e8d6f82deb3385e351 (patch)
treeded5f48f6cf82db976f30d5f0f4d44b941f60f44 /fs/ocfs2/super.c
parentbbbd0eb34bf801dee01e345785959a75258f6567 (diff)
ocfs2: Implementation of local and global quota file handling
For each quota type each node has local quota file. In this file it stores changes users have made to disk usage via this node. Once in a while this information is synced to global file (and thus with other nodes) so that limits enforcement at least aproximately works. Global quota files contain all the information about usage and limits. It's mostly handled by the generic VFS code (which implements a trie of structures inside a quota file). We only have to provide functions to convert structures from on-disk format to in-memory one. We also have to provide wrappers for various quota functions starting transactions and acquiring necessary cluster locks before the actual IO is really started. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/super.c')
-rw-r--r--fs/ocfs2/super.c38
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
71static struct kmem_cache *ocfs2_inode_cachep = NULL; 72static struct kmem_cache *ocfs2_inode_cachep = NULL;
73struct kmem_cache *ocfs2_dquot_cachep;
74struct 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
142enum { 147enum {
@@ -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);
1107leave: 1113leave:
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
1259static int ocfs2_get_sector(struct super_block *sb, 1293static int ocfs2_get_sector(struct super_block *sb,