diff options
author | Nathan Scott <nathans@sgi.com> | 2006-03-13 21:18:19 -0500 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-03-13 21:18:19 -0500 |
commit | 8758280fcc6129be89503efe93bb59eaf2f85d28 (patch) | |
tree | 395246120b571385c1f3efad773b83a932d008da /fs/xfs/linux-2.6/xfs_super.c | |
parent | 8d280b98cfe3c0b69c37d355218975c1c0279bb0 (diff) |
[XFS] Cleanup the use of zones/slabs, more consistent and allows flags to
be passed.
SGI-PV: 949073
SGI-Modid: xfs-linux-melb:xfs-kern:25122a
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 | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 59989f6f83ef..0c7ed4b29c54 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -337,8 +337,8 @@ linvfs_alloc_inode( | |||
337 | { | 337 | { |
338 | vnode_t *vp; | 338 | vnode_t *vp; |
339 | 339 | ||
340 | vp = kmem_cache_alloc(xfs_vnode_zone, kmem_flags_convert(KM_SLEEP)); | 340 | vp = kmem_zone_alloc(xfs_vnode_zone, KM_SLEEP); |
341 | if (!vp) | 341 | if (unlikely(!vp)) |
342 | return NULL; | 342 | return NULL; |
343 | return LINVFS_GET_IP(vp); | 343 | return LINVFS_GET_IP(vp); |
344 | } | 344 | } |
@@ -352,23 +352,21 @@ linvfs_destroy_inode( | |||
352 | 352 | ||
353 | STATIC void | 353 | STATIC void |
354 | linvfs_inode_init_once( | 354 | linvfs_inode_init_once( |
355 | void *data, | 355 | void *vnode, |
356 | kmem_cache_t *cachep, | 356 | kmem_zone_t *zonep, |
357 | unsigned long flags) | 357 | unsigned long flags) |
358 | { | 358 | { |
359 | vnode_t *vp = (vnode_t *)data; | ||
360 | |||
361 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == | 359 | if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) == |
362 | SLAB_CTOR_CONSTRUCTOR) | 360 | SLAB_CTOR_CONSTRUCTOR) |
363 | inode_init_once(LINVFS_GET_IP(vp)); | 361 | inode_init_once(LINVFS_GET_IP((vnode_t *)vnode)); |
364 | } | 362 | } |
365 | 363 | ||
366 | STATIC int | 364 | STATIC int |
367 | linvfs_init_zones(void) | 365 | xfs_init_zones(void) |
368 | { | 366 | { |
369 | xfs_vnode_zone = kmem_cache_create("xfs_vnode", | 367 | xfs_vnode_zone = kmem_zone_init_flags(sizeof(vnode_t), "xfs_vnode_t", |
370 | sizeof(vnode_t), 0, SLAB_RECLAIM_ACCOUNT, | 368 | KM_ZONE_HWALIGN | KM_ZONE_RECLAIM, |
371 | linvfs_inode_init_once, NULL); | 369 | linvfs_inode_init_once); |
372 | if (!xfs_vnode_zone) | 370 | if (!xfs_vnode_zone) |
373 | goto out; | 371 | goto out; |
374 | 372 | ||
@@ -377,14 +375,12 @@ linvfs_init_zones(void) | |||
377 | goto out_destroy_vnode_zone; | 375 | goto out_destroy_vnode_zone; |
378 | 376 | ||
379 | xfs_ioend_pool = mempool_create(4 * MAX_BUF_PER_PAGE, | 377 | xfs_ioend_pool = mempool_create(4 * MAX_BUF_PER_PAGE, |
380 | mempool_alloc_slab, mempool_free_slab, | 378 | mempool_alloc_slab, mempool_free_slab, |
381 | xfs_ioend_zone); | 379 | xfs_ioend_zone); |
382 | if (!xfs_ioend_pool) | 380 | if (!xfs_ioend_pool) |
383 | goto out_free_ioend_zone; | 381 | goto out_free_ioend_zone; |
384 | |||
385 | return 0; | 382 | return 0; |
386 | 383 | ||
387 | |||
388 | out_free_ioend_zone: | 384 | out_free_ioend_zone: |
389 | kmem_zone_destroy(xfs_ioend_zone); | 385 | kmem_zone_destroy(xfs_ioend_zone); |
390 | out_destroy_vnode_zone: | 386 | out_destroy_vnode_zone: |
@@ -394,7 +390,7 @@ linvfs_init_zones(void) | |||
394 | } | 390 | } |
395 | 391 | ||
396 | STATIC void | 392 | STATIC void |
397 | linvfs_destroy_zones(void) | 393 | xfs_destroy_zones(void) |
398 | { | 394 | { |
399 | mempool_destroy(xfs_ioend_pool); | 395 | mempool_destroy(xfs_ioend_pool); |
400 | kmem_zone_destroy(xfs_vnode_zone); | 396 | kmem_zone_destroy(xfs_vnode_zone); |
@@ -405,7 +401,7 @@ linvfs_destroy_zones(void) | |||
405 | * Attempt to flush the inode, this will actually fail | 401 | * Attempt to flush the inode, this will actually fail |
406 | * if the inode is pinned, but we dirty the inode again | 402 | * if the inode is pinned, but we dirty the inode again |
407 | * at the point when it is unpinned after a log write, | 403 | * at the point when it is unpinned after a log write, |
408 | * since this is when the inode itself becomes flushable. | 404 | * since this is when the inode itself becomes flushable. |
409 | */ | 405 | */ |
410 | STATIC int | 406 | STATIC int |
411 | linvfs_write_inode( | 407 | linvfs_write_inode( |
@@ -963,7 +959,7 @@ init_xfs_fs( void ) | |||
963 | 959 | ||
964 | ktrace_init(64); | 960 | ktrace_init(64); |
965 | 961 | ||
966 | error = linvfs_init_zones(); | 962 | error = xfs_init_zones(); |
967 | if (error < 0) | 963 | if (error < 0) |
968 | goto undo_zones; | 964 | goto undo_zones; |
969 | 965 | ||
@@ -986,7 +982,7 @@ undo_register: | |||
986 | xfs_buf_terminate(); | 982 | xfs_buf_terminate(); |
987 | 983 | ||
988 | undo_buffers: | 984 | undo_buffers: |
989 | linvfs_destroy_zones(); | 985 | xfs_destroy_zones(); |
990 | 986 | ||
991 | undo_zones: | 987 | undo_zones: |
992 | return error; | 988 | return error; |
@@ -1000,7 +996,7 @@ exit_xfs_fs( void ) | |||
1000 | unregister_filesystem(&xfs_fs_type); | 996 | unregister_filesystem(&xfs_fs_type); |
1001 | xfs_cleanup(); | 997 | xfs_cleanup(); |
1002 | xfs_buf_terminate(); | 998 | xfs_buf_terminate(); |
1003 | linvfs_destroy_zones(); | 999 | xfs_destroy_zones(); |
1004 | ktrace_uninit(); | 1000 | ktrace_uninit(); |
1005 | } | 1001 | } |
1006 | 1002 | ||