From patchwork Sat Mar 6 21:10:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars Ellenberg X-Patchwork-Id: 83932 X-Patchwork-Delegate: snitzer@redhat.com Received: from mx01.colomx.prod.int.phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o26LD0t1011234 for ; Sat, 6 Mar 2010 21:13:36 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx01.colomx.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o26LAbUw021039; Sat, 6 Mar 2010 16:10:39 -0500 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o26LAaFn012649 for ; Sat, 6 Mar 2010 16:10:36 -0500 Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.8]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o26LAUCr020162; Sat, 6 Mar 2010 16:10:31 -0500 Received: from mail09.linbit.com (mail09.linbit.com [212.69.161.110]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o26LAEmn004297; Sat, 6 Mar 2010 16:10:15 -0500 Received: from racke (bk1.linbit [10.9.9.6]) by mail09.linbit.com (LINBIT Mail Daemon) with ESMTP id 9D9B110003CD; Sat, 6 Mar 2010 22:10:13 +0100 (CET) Date: Sat, 6 Mar 2010 22:10:13 +0100 From: Lars Ellenberg To: Alasdair G Kergon Message-ID: <20100306211012.GA9689@racke> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-RedHat-Spam-Score: -0.544 (AWL) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.8 X-loop: dm-devel@redhat.com Cc: device-mapper development , Mikulas Patocka , linux-kernel@vger.kernel.org, jens.axboe@oracle.com Subject: [dm-devel] [PATCH] dm: max_segments=1 if merge_bvec_fn is not supported 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.3 (demeter.kernel.org [140.211.167.41]); Sat, 06 Mar 2010 21:13:36 +0000 (UTC) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index 4b22feb..c686ff4 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -515,14 +515,22 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev, /* * Check if merge fn is supported. - * If not we'll force DM to use PAGE_SIZE or + * If not we'll force DM to use single bio_vec of PAGE_SIZE or * smaller I/O, just to be safe. */ - if (q->merge_bvec_fn && !ti->type->merge) + if (q->merge_bvec_fn && !ti->type->merge) { limits->max_sectors = min_not_zero(limits->max_sectors, (unsigned int) (PAGE_SIZE >> 9)); + /* Restricting max_sectors is not enough. + * If someone uses bio_add_page to add 8 disjunct 512 byte + * partial pages to a bio, it would succeed, + * but could still cross a border of whatever restrictions + * are below us (e.g. raid0 stripe boundary). An attempted + * bio_split() would not succeed, because bi_vcnt is 8. */ + limits->max_segments = 1; + } return 0; } EXPORT_SYMBOL_GPL(dm_set_device_limits);