From patchwork Mon Mar 7 02:59:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 614521 Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2734Wd2012032 for ; Mon, 7 Mar 2011 03:04:53 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2731Q9b011112; Sun, 6 Mar 2011 22:01:27 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2731P2a031229 for ; Sun, 6 Mar 2011 22:01:25 -0500 Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.18]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p2731K4v029153 for ; Sun, 6 Mar 2011 22:01:20 -0500 Received: from rcsinet10.oracle.com (rcsinet10.oracle.com [148.87.113.121]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2731AVX005198 for ; Sun, 6 Mar 2011 22:01:10 -0500 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id p27318KZ014481 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 7 Mar 2011 03:01:09 GMT Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id p271xgXe025299 for ; Mon, 7 Mar 2011 03:01:07 GMT Received: from abhmt003.oracle.com by acsmt354.oracle.com with ESMTP id 1062519271299466787; Sun, 06 Mar 2011 18:59:47 -0800 Received: from groovelator.mkp.net (/209.217.122.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 06 Mar 2011 18:59:46 -0800 To: device-mapper development From: "Martin K. Petersen" Organization: Oracle References: <20110228114801.GZ3626@agk-dp.fab.redhat.com> <20110228121149.GA3626@agk-dp.fab.redhat.com> <20110228131028.GB3626@agk-dp.fab.redhat.com> <4D6BA566.1050305@redhat.com> <4D73F104.2050807@redhat.com> Date: Sun, 06 Mar 2011 21:59:43 -0500 In-Reply-To: <4D73F104.2050807@redhat.com> (Zdenek Kabelac's message of "Sun, 06 Mar 2011 21:39:32 +0100") Message-ID: User-Agent: Gnus/5.110013 (No Gnus v0.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 X-Source-IP: acsmt354.oracle.com [141.146.40.154] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090203.4D744A73.011C,ss=1,fgs=0 X-RedHat-Spam-Score: -102.309 (RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, USER_IN_WHITELIST) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.18 X-loop: dm-devel@redhat.com Subject: Re: [dm-devel] mirrored device with thousand of mappingtableentries X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 07 Mar 2011 03:04:53 +0000 (UTC) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 38e4eb1..37a1b77 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -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 @@ -859,7 +860,11 @@ int dm_table_alloc_md_mempools(struct dm_table *t) return -EINVAL; } - t->mempools = dm_alloc_md_mempools(type); + if (t->integrity_supported) + t->mempools = dm_alloc_md_mempools(type, 0); + else + t->mempools = dm_alloc_md_mempools(type, BIOSET_NO_INTEGRITY); + if (!t->mempools) return -ENOMEM; @@ -935,8 +940,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; } diff --git a/drivers/md/dm.c b/drivers/md/dm.c index eaa3af0..f6146b5 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2643,7 +2643,7 @@ 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 int flags) { struct dm_md_mempools *pools = kmalloc(sizeof(*pools), GFP_KERNEL); @@ -2663,7 +2663,8 @@ struct dm_md_mempools *dm_alloc_md_mempools(unsigned type) goto free_io_pool_and_out; pools->bs = (type == DM_TYPE_BIO_BASED) ? - bioset_create(16, 0) : bioset_create(MIN_IOS, 0); + bioset_create_flags(16, 0, flags) : + bioset_create_flags(MIN_IOS, 0, flags); if (!pools->bs) goto free_tio_pool_and_out; diff --git a/drivers/md/dm.h b/drivers/md/dm.h index 0c2dd5f..d846ce0 100644 --- a/drivers/md/dm.h +++ b/drivers/md/dm.h @@ -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 int); void dm_free_md_mempools(struct dm_md_mempools *pools); #endif diff --git a/fs/bio.c b/fs/bio.c index 4bd454f..6e4a381 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -1603,9 +1603,10 @@ void bioset_free(struct bio_set *bs) EXPORT_SYMBOL(bioset_free); /** - * bioset_create - Create a bio_set + * bioset_create_flags - Create a bio_set * @pool_size: Number of bio and bio_vecs to cache in the mempool * @front_pad: Number of bytes to allocate in front of the returned bio + * @flags: Flags that affect memory allocation * * Description: * Set up a bio_set to be used with @bio_alloc_bioset. Allows the caller @@ -1615,7 +1616,8 @@ EXPORT_SYMBOL(bioset_free); * Note that the bio must be embedded at the END of that structure always, * or things will break badly. */ -struct bio_set *bioset_create(unsigned int pool_size, unsigned int front_pad) +struct bio_set *bioset_create_flags(unsigned int pool_size, + unsigned int front_pad, unsigned int flags) { unsigned int back_pad = BIO_INLINE_VECS * sizeof(struct bio_vec); struct bio_set *bs; @@ -1636,7 +1638,8 @@ 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)) + if ((flags & BIOSET_NO_INTEGRITY) == 0 && + bioset_integrity_create(bs, pool_size)) goto bad; if (!biovec_create_pools(bs, pool_size)) @@ -1646,6 +1649,12 @@ bad: bioset_free(bs); return NULL; } +EXPORT_SYMBOL(bioset_create_flags); + +struct bio_set *bioset_create(unsigned int pool_size, unsigned int front_pad) +{ + return bioset_create_flags(pool_size, front_pad, 0); +} EXPORT_SYMBOL(bioset_create); static void __init biovec_init_slabs(void) diff --git a/include/linux/bio.h b/include/linux/bio.h index 35dcdb3..2f758f3 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -208,7 +208,12 @@ struct bio_pair { extern struct bio_pair *bio_split(struct bio *bi, int first_sectors); extern void bio_pair_release(struct bio_pair *dbio); +enum bioset_flags { + BIOSET_NO_INTEGRITY = (1 << 0), +}; + extern struct bio_set *bioset_create(unsigned int, unsigned int); +extern struct bio_set *bioset_create_flags(unsigned int, unsigned int, unsigned int); extern void bioset_free(struct bio_set *); extern struct bio *bio_alloc(gfp_t, int);