diff options
author | Christoph Hellwig <hch@sgi.com> | 2005-09-02 02:58:49 -0400 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-09-02 02:58:49 -0400 |
commit | 0829c3602f4df95898752c402ea90b92a3e33154 (patch) | |
tree | 35c0efa4e1fe35b118165fea5812fe9248f30023 /fs/xfs/linux-2.6/xfs_super.c | |
parent | 51c91ed52b8a9a30fcb2a465b40c20a1f11735ba (diff) |
[XFS] Add infrastructure for tracking I/O completions
SGI-PV: 934766
SGI-Modid: xfs-linux:xfs-kern:196856a
Signed-off-by: Christoph Hellwig <hch@sgi.com>
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_super.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 58 |
1 files changed, 40 insertions, 18 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index d2c8a11e22b8..1a0bcbbc0a86 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -70,11 +70,14 @@ | |||
70 | #include <linux/namei.h> | 70 | #include <linux/namei.h> |
71 | #include <linux/init.h> | 71 | #include <linux/init.h> |
72 | #include <linux/mount.h> | 72 | #include <linux/mount.h> |
73 | #include <linux/mempool.h> | ||
73 | #include <linux/writeback.h> | 74 | #include <linux/writeback.h> |
74 | 75 | ||
75 | STATIC struct quotactl_ops linvfs_qops; | 76 | STATIC struct quotactl_ops linvfs_qops; |
76 | STATIC struct super_operations linvfs_sops; | 77 | STATIC struct super_operations linvfs_sops; |
77 | STATIC kmem_zone_t *linvfs_inode_zone; | 78 | STATIC kmem_zone_t *xfs_vnode_zone; |
79 | STATIC kmem_zone_t *xfs_ioend_zone; | ||
80 | mempool_t *xfs_ioend_pool; | ||
78 | 81 | ||
79 | STATIC struct xfs_mount_args * | 82 | STATIC struct xfs_mount_args * |
80 | xfs_args_allocate( | 83 | xfs_args_allocate( |
@@ -281,8 +284,7 @@ linvfs_alloc_inode( | |||
281 | { | 284 | { |
282 | vnode_t *vp; | 285 | vnode_t *vp; |
283 | 286 | ||
284 | vp = (vnode_t *)kmem_cache_alloc(linvfs_inode_zone, | 287 | vp = kmem_cache_alloc(xfs_vnode_zone, kmem_flags_convert(KM_SLEEP)); |
285 | kmem_flags_convert(KM_SLEEP)); | ||
286 | if (!vp) | 288 | if (!vp) |
287 | return NULL; | 289 | return NULL; |
288 | return LINVFS_GET_IP(vp); | 290 | return LINVFS_GET_IP(vp); |
@@ -292,11 +294,11 @@ STATIC void | |||
292 | linvfs_destroy_inode( | 294 | linvfs_destroy_inode( |
293 | struct inode *inode) | 295 | struct inode *inode) |
294 | { | 296 | { |
295 | kmem_cache_free(linvfs_inode_zone, LINVFS_GET_VP(inode)); | 297 | kmem_zone_free(xfs_vnode_zone, LINVFS_GET_VP(inode)); |
296 | } | 298 | } |
297 | 299 | ||
298 | STATIC void | 300 | STATIC void |
299 | init_once( | 301 | linvfs_inode_init_once( |
300 | void *data, | 302 | void *data, |
301 | kmem_cache_t *cachep, | 303 | kmem_cache_t *cachep, |
302 | unsigned long flags) | 304 | unsigned long flags) |
@@ -309,21 +311,41 @@ init_once( | |||
309 | } | 311 | } |
310 | 312 | ||
311 | STATIC int | 313 | STATIC int |
312 | init_inodecache( void ) | 314 | linvfs_init_zones(void) |
313 | { | 315 | { |
314 | linvfs_inode_zone = kmem_cache_create("linvfs_icache", | 316 | xfs_vnode_zone = kmem_cache_create("xfs_vnode", |
315 | sizeof(vnode_t), 0, SLAB_RECLAIM_ACCOUNT, | 317 | sizeof(vnode_t), 0, SLAB_RECLAIM_ACCOUNT, |
316 | init_once, NULL); | 318 | linvfs_inode_init_once, NULL); |
317 | if (linvfs_inode_zone == NULL) | 319 | if (!xfs_vnode_zone) |
318 | return -ENOMEM; | 320 | goto out; |
321 | |||
322 | xfs_ioend_zone = kmem_zone_init(sizeof(xfs_ioend_t), "xfs_ioend"); | ||
323 | if (!xfs_ioend_zone) | ||
324 | goto out_destroy_vnode_zone; | ||
325 | |||
326 | xfs_ioend_pool = mempool_create(4 * MAX_BUF_PER_PAGE, | ||
327 | mempool_alloc_slab, mempool_free_slab, | ||
328 | xfs_ioend_zone); | ||
329 | if (!xfs_ioend_pool) | ||
330 | goto out_free_ioend_zone; | ||
331 | |||
319 | return 0; | 332 | return 0; |
333 | |||
334 | |||
335 | out_free_ioend_zone: | ||
336 | kmem_zone_destroy(xfs_ioend_zone); | ||
337 | out_destroy_vnode_zone: | ||
338 | kmem_zone_destroy(xfs_vnode_zone); | ||
339 | out: | ||
340 | return -ENOMEM; | ||
320 | } | 341 | } |
321 | 342 | ||
322 | STATIC void | 343 | STATIC void |
323 | destroy_inodecache( void ) | 344 | linvfs_destroy_zones(void) |
324 | { | 345 | { |
325 | if (kmem_cache_destroy(linvfs_inode_zone)) | 346 | mempool_destroy(xfs_ioend_pool); |
326 | printk(KERN_WARNING "%s: cache still in use!\n", __FUNCTION__); | 347 | kmem_zone_destroy(xfs_vnode_zone); |
348 | kmem_zone_destroy(xfs_ioend_zone); | ||
327 | } | 349 | } |
328 | 350 | ||
329 | /* | 351 | /* |
@@ -873,9 +895,9 @@ init_xfs_fs( void ) | |||
873 | 895 | ||
874 | ktrace_init(64); | 896 | ktrace_init(64); |
875 | 897 | ||
876 | error = init_inodecache(); | 898 | error = linvfs_init_zones(); |
877 | if (error < 0) | 899 | if (error < 0) |
878 | goto undo_inodecache; | 900 | goto undo_zones; |
879 | 901 | ||
880 | error = pagebuf_init(); | 902 | error = pagebuf_init(); |
881 | if (error < 0) | 903 | if (error < 0) |
@@ -896,9 +918,9 @@ undo_register: | |||
896 | pagebuf_terminate(); | 918 | pagebuf_terminate(); |
897 | 919 | ||
898 | undo_pagebuf: | 920 | undo_pagebuf: |
899 | destroy_inodecache(); | 921 | linvfs_destroy_zones(); |
900 | 922 | ||
901 | undo_inodecache: | 923 | undo_zones: |
902 | return error; | 924 | return error; |
903 | } | 925 | } |
904 | 926 | ||
@@ -910,7 +932,7 @@ exit_xfs_fs( void ) | |||
910 | unregister_filesystem(&xfs_fs_type); | 932 | unregister_filesystem(&xfs_fs_type); |
911 | xfs_cleanup(); | 933 | xfs_cleanup(); |
912 | pagebuf_terminate(); | 934 | pagebuf_terminate(); |
913 | destroy_inodecache(); | 935 | linvfs_destroy_zones(); |
914 | ktrace_uninit(); | 936 | ktrace_uninit(); |
915 | } | 937 | } |
916 | 938 | ||