From patchwork Mon Oct 15 20:08:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1595751 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 2A63D3FD86 for ; Mon, 15 Oct 2012 20:14:04 +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 q9FKBDaK006800; Mon, 15 Oct 2012 16:11:13 -0400 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 q9FKA4AX026935 for ; Mon, 15 Oct 2012 16:10:04 -0400 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 q9FK9xoU004732 for ; Mon, 15 Oct 2012 16:09:59 -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 q9FK9w0H007554 for ; Mon, 15 Oct 2012 16:09:58 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr4so5284811pbb.33 for ; Mon, 15 Oct 2012 13:09:57 -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=pZrSylegk2Jgvz4qlY0uaFhLeG6eCI0YpUo7WFtZ2oy4baC85+95zrDOPQO9NDN9wD tZ1c8+PvZ686fPglG6ueRicqVGK50DUAT2uBn91EVg8p51I1CdLk3t9ZTVy56gxH6IX2 2lRV5UHP7n4bFGBtfxBHEUV8Kkk405VkwWzAHCFirAntuXf7xEODTiSQgb4HkzC7Yj0A tL4RTRV8gFvqc9UPnB5h+op9sU4rbPrtwOsdmY0FZQb6u60XeIp5iN5N6vw44f0t3I7o Um3uwQBM2JdhseNkAJSRLWjbbskhfXjB4o0ud8lGnv2Hsxpd122gdaetHzAI6tVQwNjk 3cWA== 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=F4bEpvQfna5enFUFpSzgenGFg/X0trSyyl4y5ND4YjHx/8tPqcWwZRkibrQhcCdC/e pc1BLL8YIBpcDSCJKXFsXpkeKGe0bzGQZ1NVgveX51mt5MmRv6NIS8FjmUQEvOmHyvmg XlC+YRSyNrHp+zMexdAGZ4Lje6M013aH/tuLdrdDwcTQQ/3WTPnPJ+c9c97RuQinOLWM Sp0IwWHuX8aEeKIuXya/s6vgtZ3lxjXb+6SCY7szOl9GuiUIjvdz7UGS1grnOokPLgGD PfpDiLoZwGwurF2sse0JcaGztio0uyxLnlbZWpcLN/anjcWmGamgHeGCLmFAsNBmZAlX x/eg== Received: by 10.68.130.165 with SMTP id of5mr40162596pbb.113.1350331797873; Mon, 15 Oct 2012 13:09:57 -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.09.56 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 13:09:57 -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:08:45 -0700 Message-Id: <1350331769-14856-12-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: ALoCoQlCnJYVMP56wM+DiktBC1snB/2p/SbQ/ayOWIe9rsWGqwvnx61us1Licw3x//GsQTsehNDhwHKl5aODfp/DYsE+gcp0lkvUSZmUQ0vVH1sd1hw5wHZ6clx6tzVX/uRiK9PZjMEJE01nWJv/csUbJ0kT8HFq0M8OVgzogOnj0WdOMpW+8pPbtamHfOkzTD2u8OEwVrr3 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.68 on 10.5.11.22 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 , vgoyal@redhat.com Subject: [dm-devel] [PATCH v4 11/24] 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 ||