From patchwork Mon Sep 24 22:34:53 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1500791 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork1.kernel.org (Postfix) with ESMTP id 248A93FE80 for ; Mon, 24 Sep 2012 22:39:11 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8OMbFML026107; Mon, 24 Sep 2012 18:37:15 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8OMZsTK009248 for ; Mon, 24 Sep 2012 18:35:54 -0400 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8OMZnR6006336 for ; Mon, 24 Sep 2012 18:35:49 -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 q8OMZdaO014004 for ; Mon, 24 Sep 2012 18:35:45 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr4so7786877pbb.33 for ; Mon, 24 Sep 2012 15:35:45 -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=P4D0QxeuWD1xhr8imYa5TeksV0hZN4JhWPn8xY6bcxY=; b=YttdJmgDH6jhQN5sz0VUyTHuh/sVFRWM+hf2Z2fGFdoUxpl+gfTzHLRiku88jctpr7 87HtpjRUFasI1joIQpVaF3cBId/XJzV8pwh4mVbV0VIpnJ29AVyu0p8t/PAonSWTCfMU t/1x771LkSF93/Qz8f3M3x7FrpJR+CQzJlBazL9WNCQJi/vdTLicnJg6OeR61dtMiheJ mgRHRmuZivmDx+YF5wnrMbYn468w1Zw6C5UGUzpcDGcNd+K6S2/yncSDuhIq0zeC6FbE HG2Yin8h3Igk9Gkd/z+1IocG/qnSqUspf3Nv2clF136miIqw9I/8Hj6SMbGnpfW7SlGE rLVw== 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=P4D0QxeuWD1xhr8imYa5TeksV0hZN4JhWPn8xY6bcxY=; b=CluOK6Qx4XzaCy7U0qJ6frzadE02I7AIw6lOiQlIywDIJRUOG+iyIK/HnK0zS/GYWu QPeh+rzITuwhggiKchGB+/w1LRG5EIYK5dj06PjlcA7Tf3Brv5iuZGQXMqYtI+RUUn55 w7ZN/ulzqMtnKj7gAZxSrOI343Y430VkdMi5fCWfqJoQXp7tvdEVfPp3ylGcTKUMbJKx +sYPJc09ey+twbqk+GSEi3XE/X8sxB/JoR12JiFjAmYdnF1ptVGtp+nw2mvzGEAwxRDw 4GRJ0jaeBjs6rCJOoAkay92GGXiRLV8WLt0kFbPuODegNb4TqJ6ugKqkXpNgJUCMo3sR NBdg== Received: by 10.66.77.193 with SMTP id u1mr35873890paw.52.1348526145555; Mon, 24 Sep 2012 15:35:45 -0700 (PDT) Received: by 10.66.77.193 with SMTP id u1mr35873875paw.52.1348526145479; Mon, 24 Sep 2012 15:35:45 -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 nu8sm133316pbc.45.2012.09.24.15.35.44 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Sep 2012 15:35:44 -0700 (PDT) From: Kent Overstreet To: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, dm-devel@redhat.com Date: Mon, 24 Sep 2012 15:34:53 -0700 Message-Id: <1348526106-17074-14-git-send-email-koverstreet@google.com> In-Reply-To: <1348526106-17074-1-git-send-email-koverstreet@google.com> References: <1348526106-17074-1-git-send-email-koverstreet@google.com> X-Gm-Message-State: ALoCoQlzOEROXckMzi8pm4mbFrZUn32x24+5Bo89+wmLwCL1sE4ZWPEqR9r1D7SjT3qVELOtewRsDp/qCGTDp+wD6GWm3CbRDFtDi8VlvDRc7d57BY0OfGQ3UQwkc+Bu16hOiFwAh4N2y/DJLBGtoE1E8kQRRd01Un1sFqL5cdTcznysphhidUcGzJGslLfq9JT7IiOZqIPP X-RedHat-Spam-Score: -3.512 (BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: tj@kernel.org, axboe@kernel.dk, Kent Overstreet , vgoyal@redhat.com Subject: [dm-devel] [PATCH v3 13/26] raid1: use bio_reset() 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 | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 28f506a..4614b9e 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1851,7 +1851,7 @@ static int process_checks(struct r1bio *r1_bio) struct bio *sbio = r1_bio->bios[i]; int size; - if (r1_bio->bios[i]->bi_end_io != end_sync_read) + if (sbio->bi_end_io != end_sync_read) continue; if (test_bit(BIO_UPTODATE, &sbio->bi_flags)) { @@ -1876,16 +1876,15 @@ static int process_checks(struct r1bio *r1_bio) continue; } /* fixup the bio for reuse */ + bio_reset(sbio); sbio->bi_vcnt = vcnt; sbio->bi_size = r1_bio->sectors << 9; - sbio->bi_idx = 0; - sbio->bi_phys_segments = 0; - sbio->bi_flags &= ~(BIO_POOL_MASK - 1); - sbio->bi_flags |= 1 << BIO_UPTODATE; - sbio->bi_next = NULL; sbio->bi_sector = r1_bio->sector + conf->mirrors[i].rdev->data_offset; sbio->bi_bdev = conf->mirrors[i].rdev->bdev; + sbio->bi_end_io = end_sync_read; + sbio->bi_private = r1_bio; + size = sbio->bi_size; for (j = 0; j < vcnt ; j++) { struct bio_vec *bi; @@ -2426,18 +2425,7 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, int *skipp for (i = 0; i < conf->raid_disks * 2; i++) { struct md_rdev *rdev; bio = r1_bio->bios[i]; - - /* take from bio_init */ - bio->bi_next = NULL; - bio->bi_flags &= ~(BIO_POOL_MASK-1); - bio->bi_flags |= 1 << BIO_UPTODATE; - bio->bi_rw = READ; - bio->bi_vcnt = 0; - bio->bi_idx = 0; - bio->bi_phys_segments = 0; - bio->bi_size = 0; - bio->bi_end_io = NULL; - bio->bi_private = NULL; + bio_reset(bio); rdev = rcu_dereference(conf->mirrors[i].rdev); if (rdev == NULL ||