xfs: optimize bio handling in the buffer writeback path
This patch implements two closely related changes: First it embeds a bio the ioend structure so that we don't have to allocate one separately. Second it uses the block layer bio chaining mechanism to chain additional bios off this first one if needed instead of manually accounting for multiple bio completions in the ioend structure. Together this removes a memory allocation per ioend and greatly simplifies the ioend setup and I/O completion path. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
This commit is contained in:

committed by
Dave Chinner

parent
37992c18bb
commit
0e51a8e191
@@ -58,8 +58,7 @@
|
||||
#include <linux/parser.h>
|
||||
|
||||
static const struct super_operations xfs_super_operations;
|
||||
static kmem_zone_t *xfs_ioend_zone;
|
||||
mempool_t *xfs_ioend_pool;
|
||||
struct bio_set *xfs_ioend_bioset;
|
||||
|
||||
static struct kset *xfs_kset; /* top-level xfs sysfs dir */
|
||||
#ifdef DEBUG
|
||||
@@ -1688,20 +1687,15 @@ MODULE_ALIAS_FS("xfs");
|
||||
STATIC int __init
|
||||
xfs_init_zones(void)
|
||||
{
|
||||
|
||||
xfs_ioend_zone = kmem_zone_init(sizeof(xfs_ioend_t), "xfs_ioend");
|
||||
if (!xfs_ioend_zone)
|
||||
xfs_ioend_bioset = bioset_create(4 * MAX_BUF_PER_PAGE,
|
||||
offsetof(struct xfs_ioend, io_inline_bio));
|
||||
if (!xfs_ioend_bioset)
|
||||
goto out;
|
||||
|
||||
xfs_ioend_pool = mempool_create_slab_pool(4 * MAX_BUF_PER_PAGE,
|
||||
xfs_ioend_zone);
|
||||
if (!xfs_ioend_pool)
|
||||
goto out_destroy_ioend_zone;
|
||||
|
||||
xfs_log_ticket_zone = kmem_zone_init(sizeof(xlog_ticket_t),
|
||||
"xfs_log_ticket");
|
||||
if (!xfs_log_ticket_zone)
|
||||
goto out_destroy_ioend_pool;
|
||||
goto out_free_ioend_bioset;
|
||||
|
||||
xfs_bmap_free_item_zone = kmem_zone_init(sizeof(xfs_bmap_free_item_t),
|
||||
"xfs_bmap_free_item");
|
||||
@@ -1797,10 +1791,8 @@ xfs_init_zones(void)
|
||||
kmem_zone_destroy(xfs_bmap_free_item_zone);
|
||||
out_destroy_log_ticket_zone:
|
||||
kmem_zone_destroy(xfs_log_ticket_zone);
|
||||
out_destroy_ioend_pool:
|
||||
mempool_destroy(xfs_ioend_pool);
|
||||
out_destroy_ioend_zone:
|
||||
kmem_zone_destroy(xfs_ioend_zone);
|
||||
out_free_ioend_bioset:
|
||||
bioset_free(xfs_ioend_bioset);
|
||||
out:
|
||||
return -ENOMEM;
|
||||
}
|
||||
@@ -1826,9 +1818,7 @@ xfs_destroy_zones(void)
|
||||
kmem_zone_destroy(xfs_btree_cur_zone);
|
||||
kmem_zone_destroy(xfs_bmap_free_item_zone);
|
||||
kmem_zone_destroy(xfs_log_ticket_zone);
|
||||
mempool_destroy(xfs_ioend_pool);
|
||||
kmem_zone_destroy(xfs_ioend_zone);
|
||||
|
||||
bioset_free(xfs_ioend_bioset);
|
||||
}
|
||||
|
||||
STATIC int __init
|
||||
|
Reference in New Issue
Block a user