From patchwork Mon Oct 15 20:09:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1595871 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by patchwork1.kernel.org (Postfix) with ESMTP id 74F2C3FD86 for ; Mon, 15 Oct 2012 20:14:31 +0000 (UTC) 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 q9FKBfNh010572; Mon, 15 Oct 2012 16:11:41 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9FKB5cF027367 for ; Mon, 15 Oct 2012 16:11:05 -0400 Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.18]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9FKB0ev019426 for ; Mon, 15 Oct 2012 16:11:00 -0400 Received: from mail-pb0-f46.google.com (mail-pb0-f46.google.com [209.85.160.46]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9FK9iMN007481 for ; Mon, 15 Oct 2012 16:10:59 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr4so5284636pbb.33 for ; Mon, 15 Oct 2012 13:10:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=UcWYdnlpbc0+37LmBRCtohS8WOJ72+tjUx+sC2Dvq3Q=; b=b5ZQpTeeVjhNTJapoIli0TWXYMxhJpwoWRa5klnsmYOPbtwyHDyNDuJb0eanBjIwwf YyiQZ6Y6peEe+7cOJXDrd+UPdMTI20xAvP/YdUrwXjN1L9urVLS7fDkJPLL+1OlFJUVk Gxw1ASMv7jFP36UXKeoLBvEX9EJkxe9wwY+8L7D/pn+Mf5mNsBQ24Zkzh+0o8qCrhHPo cpcvT2oicddhz/dZtpb8SPvjeP/rLwuEtaX0sCWopCd8t9uRdOn652RzZZofqY4ikK0K vSaAbkwH21T/4cZSoVvggkS+A2pGkbQwmJNoo4viDZAHZPbiJWwG4YUb2qPQdi4FY8UL HZUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=UcWYdnlpbc0+37LmBRCtohS8WOJ72+tjUx+sC2Dvq3Q=; b=aDiUgvRSVHyNyzf2kW8P7q9Yta6Ce/oLhsb7faYilAOjxXS16wa5HG88XAl3IHpPyY LLY9yTSeyZrVp3rAQsW2CbM0uz1qGg5JqpwAW3zqewNryhiMzzqZIDKAae7o7PDkQIPt 5SY4c4Z+EHr9Uia75cMjT/Ylh6VDrEB5ZNA/kX3LFB+QdkRpl+ffB7qdUB2J9AsTODl8 3Ncvqqkv+p+2LZ0Gr76LnKZdK/s4hikmOxXDMAW+/BcY5VIht3oWq4dwi3sbIqXTeYxE eWcReGgNXQr0hj0eywuWZ+02UjgzdfffcmtJqbspw8pnVIoakknjGDswZbL38MKVz/9C Rfmw== Received: by 10.68.116.239 with SMTP id jz15mr40480027pbb.43.1350331859031; Mon, 15 Oct 2012 13:10:59 -0700 (PDT) Received: from formenos.mtv.corp.google.com (formenos.mtv.corp.google.com [172.18.110.66]) by mx.google.com with ESMTPS id k9sm3021703paz.22.2012.10.15.13.10.57 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 13:10:58 -0700 (PDT) From: Kent Overstreet To: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, dm-devel@redhat.com Date: Mon, 15 Oct 2012 13:09:26 -0700 Message-Id: <1350331769-14856-53-git-send-email-koverstreet@google.com> In-Reply-To: <1350331769-14856-1-git-send-email-koverstreet@google.com> References: <1350331769-14856-1-git-send-email-koverstreet@google.com> X-Gm-Message-State: ALoCoQmgjsf9a443atyqSogk20kASk1vWQRddvnMZHJBD3l0uHaDmVuXmDjFeidxhL0mIBeTVfRruxIJpEXluq+e5nLhHRh/kTrJl5Tea+iuztQonkZLaxxZhLvy+YEW3MWuuMx3At89Wnv31QiKtTUZXRMm3r90+YwujllBUcsCeX/YX39vRYkorlyNnQ1H+VsU4AaOujUL X-RedHat-Spam-Score: -3.072 (BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.18 X-loop: dm-devel@redhat.com Cc: tj@kernel.org, axboe@kernel.dk, Kent Overstreet Subject: [dm-devel] [PATCH v2 23/26] raid1: use bio_alloc_pages() 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Signed-off-by: Kent Overstreet CC: Jens Axboe CC: NeilBrown --- drivers/md/raid1.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index d30b4cb..18b743a 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -92,7 +92,6 @@ static void r1bio_pool_free(void *r1_bio, void *data) static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data) { struct pool_info *pi = data; - struct page *page; struct r1bio *r1_bio; struct bio *bio; int i, j; @@ -122,14 +121,10 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data) j = 1; while(j--) { bio = r1_bio->bios[j]; - for (i = 0; i < RESYNC_PAGES; i++) { - page = alloc_page(gfp_flags); - if (unlikely(!page)) - goto out_free_pages; + bio->bi_vcnt = RESYNC_PAGES; - bio->bi_io_vec[i].bv_page = page; - bio->bi_vcnt = i+1; - } + if (bio_alloc_pages(bio, gfp_flags)) + goto out_free_bio; } /* If not user-requests, copy the page pointers to all bios */ if (!test_bit(MD_RECOVERY_REQUESTED, &pi->mddev->recovery)) { @@ -143,11 +138,6 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data) return r1_bio; -out_free_pages: - for (j=0 ; j < pi->raid_disks; j++) - for (i=0; i < r1_bio->bios[j]->bi_vcnt ; i++) - put_page(r1_bio->bios[j]->bi_io_vec[i].bv_page); - j = -1; out_free_bio: while (++j < pi->raid_disks) bio_put(r1_bio->bios[j]);