Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242293
b: refs/heads/master
c: a91a278
h: refs/heads/master
i:
  242291: 73d329e
v: v3
  • Loading branch information
Martin K. Petersen authored and Jens Axboe committed Mar 17, 2011
1 parent da9a373 commit ed44cba
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 82f04ab47e1d94d78503591a7460b2cad9601ede
refs/heads/master: a91a2785b200864aef2270ed6a3babac7a253a20
7 changes: 5 additions & 2 deletions trunk/drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct dm_table {
struct dm_target *targets;

unsigned discards_supported:1;
unsigned integrity_supported:1;

/*
* Indicates the rw permissions for the new logical
Expand Down Expand Up @@ -859,7 +860,7 @@ int dm_table_alloc_md_mempools(struct dm_table *t)
return -EINVAL;
}

t->mempools = dm_alloc_md_mempools(type);
t->mempools = dm_alloc_md_mempools(type, t->integrity_supported);
if (!t->mempools)
return -ENOMEM;

Expand Down Expand Up @@ -935,8 +936,10 @@ static int dm_table_prealloc_integrity(struct dm_table *t, struct mapped_device
struct dm_dev_internal *dd;

list_for_each_entry(dd, devices, list)
if (bdev_get_integrity(dd->dm_dev.bdev))
if (bdev_get_integrity(dd->dm_dev.bdev)) {
t->integrity_supported = 1;
return blk_integrity_register(dm_disk(md), NULL);
}

return 0;
}
Expand Down
12 changes: 9 additions & 3 deletions trunk/drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2620,9 +2620,10 @@ int dm_noflush_suspending(struct dm_target *ti)
}
EXPORT_SYMBOL_GPL(dm_noflush_suspending);

struct dm_md_mempools *dm_alloc_md_mempools(unsigned type)
struct dm_md_mempools *dm_alloc_md_mempools(unsigned type, unsigned integrity)
{
struct dm_md_mempools *pools = kmalloc(sizeof(*pools), GFP_KERNEL);
unsigned int pool_size = (type == DM_TYPE_BIO_BASED) ? 16 : MIN_IOS;

if (!pools)
return NULL;
Expand All @@ -2639,13 +2640,18 @@ struct dm_md_mempools *dm_alloc_md_mempools(unsigned type)
if (!pools->tio_pool)
goto free_io_pool_and_out;

pools->bs = (type == DM_TYPE_BIO_BASED) ?
bioset_create(16, 0) : bioset_create(MIN_IOS, 0);
pools->bs = bioset_create(pool_size, 0);
if (!pools->bs)
goto free_tio_pool_and_out;

if (integrity && bioset_integrity_create(pools->bs, pool_size))
goto free_bioset_and_out;

return pools;

free_bioset_and_out:
bioset_free(pools->bs);

free_tio_pool_and_out:
mempool_destroy(pools->tio_pool);

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/md/dm.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void dm_kcopyd_exit(void);
/*
* Mempool operations
*/
struct dm_md_mempools *dm_alloc_md_mempools(unsigned type);
struct dm_md_mempools *dm_alloc_md_mempools(unsigned type, unsigned integrity);
void dm_free_md_mempools(struct dm_md_mempools *pools);

#endif
3 changes: 1 addition & 2 deletions trunk/drivers/md/linear.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ static int linear_run (mddev_t *mddev)
blk_queue_merge_bvec(mddev->queue, linear_mergeable_bvec);
mddev->queue->backing_dev_info.congested_fn = linear_congested;
mddev->queue->backing_dev_info.congested_data = mddev;
md_integrity_register(mddev);
return 0;
return md_integrity_register(mddev);
}

static void free_conf(struct rcu_head *head)
Expand Down
8 changes: 6 additions & 2 deletions trunk/drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -1803,8 +1803,12 @@ int md_integrity_register(mddev_t *mddev)
mdname(mddev));
return -EINVAL;
}
printk(KERN_NOTICE "md: data integrity on %s enabled\n",
mdname(mddev));
printk(KERN_NOTICE "md: data integrity enabled on %s\n", mdname(mddev));
if (bioset_integrity_create(mddev->bio_set, BIO_POOL_SIZE)) {
printk(KERN_ERR "md: failed to create integrity pool for %s\n",
mdname(mddev));
return -EINVAL;
}
return 0;
}
EXPORT_SYMBOL(md_integrity_register);
Expand Down
7 changes: 5 additions & 2 deletions trunk/drivers/md/multipath.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ static int multipath_remove_disk(mddev_t *mddev, int number)
p->rdev = rdev;
goto abort;
}
md_integrity_register(mddev);
err = md_integrity_register(mddev);
}
abort:

Expand Down Expand Up @@ -489,7 +489,10 @@ static int multipath_run (mddev_t *mddev)

mddev->queue->backing_dev_info.congested_fn = multipath_congested;
mddev->queue->backing_dev_info.congested_data = mddev;
md_integrity_register(mddev);

if (md_integrity_register(mddev))
goto out_free_conf;

return 0;

out_free_conf:
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/md/raid0.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,7 @@ static int raid0_run(mddev_t *mddev)

blk_queue_merge_bvec(mddev->queue, raid0_mergeable_bvec);
dump_zones(mddev);
md_integrity_register(mddev);
return 0;
return md_integrity_register(mddev);
}

static int raid0_stop(mddev_t *mddev)
Expand Down
5 changes: 2 additions & 3 deletions trunk/drivers/md/raid1.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ static int raid1_remove_disk(mddev_t *mddev, int number)
p->rdev = rdev;
goto abort;
}
md_integrity_register(mddev);
err = md_integrity_register(mddev);
}
abort:

Expand Down Expand Up @@ -2017,8 +2017,7 @@ static int run(mddev_t *mddev)

mddev->queue->backing_dev_info.congested_fn = raid1_congested;
mddev->queue->backing_dev_info.congested_data = mddev;
md_integrity_register(mddev);
return 0;
return md_integrity_register(mddev);
}

static int stop(mddev_t *mddev)
Expand Down
7 changes: 5 additions & 2 deletions trunk/drivers/md/raid10.c
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ static int raid10_remove_disk(mddev_t *mddev, int number)
p->rdev = rdev;
goto abort;
}
md_integrity_register(mddev);
err = md_integrity_register(mddev);
}
abort:

Expand Down Expand Up @@ -2343,7 +2343,10 @@ static int run(mddev_t *mddev)

if (conf->near_copies < conf->raid_disks)
blk_queue_merge_bvec(mddev->queue, raid10_mergeable_bvec);
md_integrity_register(mddev);

if (md_integrity_register(mddev))
goto out_free_conf;

return 0;

out_free_conf:
Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/bio-integrity.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,9 @@ int bioset_integrity_create(struct bio_set *bs, int pool_size)
{
unsigned int max_slab = vecs_to_idx(BIO_MAX_PAGES);

if (bs->bio_integrity_pool)
return 0;

bs->bio_integrity_pool =
mempool_create_slab_pool(pool_size, bip_slab[max_slab].slab);

Expand Down
6 changes: 3 additions & 3 deletions trunk/fs/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1636,9 +1636,6 @@ struct bio_set *bioset_create(unsigned int pool_size, unsigned int front_pad)
if (!bs->bio_pool)
goto bad;

if (bioset_integrity_create(bs, pool_size))
goto bad;

if (!biovec_create_pools(bs, pool_size))
return bs;

Expand Down Expand Up @@ -1682,6 +1679,9 @@ static int __init init_bio(void)
if (!fs_bio_set)
panic("bio: can't allocate bios\n");

if (bioset_integrity_create(fs_bio_set, BIO_POOL_SIZE))
panic("bio: can't create integrity pool\n");

bio_split_pool = mempool_create_kmalloc_pool(BIO_SPLIT_ENTRIES,
sizeof(struct bio_pair));
if (!bio_split_pool)
Expand Down

0 comments on commit ed44cba

Please sign in to comment.