From patchwork Mon Oct 15 20:08:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1595921 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by patchwork2.kernel.org (Postfix) with ESMTP id ECB01DFB34 for ; Mon, 15 Oct 2012 20:14:41 +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 q9FKBBta006786; Mon, 15 Oct 2012 16:11:11 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9FKAAmk026999 for ; Mon, 15 Oct 2012 16:10:10 -0400 Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.18]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9FKA3Hb008381 for ; Mon, 15 Oct 2012 16:10:05 -0400 Received: from mail-da0-f46.google.com (mail-da0-f46.google.com [209.85.210.46]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9FK9m2o007506 for ; Mon, 15 Oct 2012 16:10:02 -0400 Received: by mail-da0-f46.google.com with SMTP id n41so2761040dak.33 for ; Mon, 15 Oct 2012 13:10:02 -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=czIdss1JP6ScFSvWm2IQPdqP7/KlFgbeTHVTb8MtbS0=; b=HRQ1+mrb72Ha9kavyw4iKOl6SwSifjlHBmj/rii6uiSa+h1D20DRbi1VJCqSO4/4NS QhvLp71yBwSfAM7k6XX/VHFcQ3wem6mgr97MDWNGrNcGkA/QDDKhr7SBtUDkl4VgTR6S UIQykNaX/vsIx1wcpzwaUovwHDvygGG+Mqh/jHBRTLvN2SPAswhXDDOiFHxGpygk1isg 3feAZZjzRpvOFntRV0Fg8lrJXtXP2+dA/f7qeMD/Mq58jbrYgHrF+klwEhN1axfiU6yB qvUmdfL0pSwQCnT5lVb75L6BAh5MmJEZlCsYIeNt3q/Vs1ODJSBPHomVK4I2SN9iRlYa VqPQ== 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=czIdss1JP6ScFSvWm2IQPdqP7/KlFgbeTHVTb8MtbS0=; b=R2zuJRud7fV6tcjlXiUACPQsalmwnaJJ04TWDe2cfC0I2t51FtCXoHhuBXkoPWhuxk czzevN3qXGCdWibpu5JSYkYTqh6Bfk6UIqhl/rGK2bpfyhvr23Styrhui279w9WZIczq TnPbaykZnL9Nz0VUEZD/jHhXmileD2JzhH3P/+NVGSdxZCFXnQdk3uoVn5DqZ+VGL4wg IRpYUpzeU0NpzZVIUqgJ0BeMuaxqj5vvNhS4ICKy0e94VpnAOrQYZy3+jx2fM8/t2MhW N7V2hJBdTXqJvkyvvnHMQSgmxg8K9JxWeTId8UE4ocP7Dr6hOW0TZ3ytCAfzx0ZpGE7x EcfA== Received: by 10.68.226.136 with SMTP id rs8mr40464737pbc.153.1350331802418; Mon, 15 Oct 2012 13:10:02 -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.57 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 13:10:01 -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:46 -0700 Message-Id: <1350331769-14856-13-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: ALoCoQk4Xx/Yhfi3RLP6y0KHXgQonK6/eKTphQNFRh5L5W2ZIPDL8iJWxVAd1ZR4diKC373eUUkPqxjuuA5/gc7g9HBEUw5oIqcWdLON5lYmTfP/LJ7xwAOpDT9EuzQP0e2zm2qai/iJP4sj1WSL4Afmxzsq0jiBuW0aqRlMmTu+SRxknMTal2muwCTn+vbjvGkSaIuP5cqF 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.11 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 12/24] raid5: 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 Had to shuffle the code around a bit (where bi_rw and bi_end_io were set), but shouldn't really be anything tricky here Signed-off-by: Kent Overstreet CC: Jens Axboe CC: NeilBrown --- drivers/md/raid5.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index cbfc424..5e327ae 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -561,14 +561,6 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) bi = &sh->dev[i].req; rbi = &sh->dev[i].rreq; /* For writing to replacement */ - bi->bi_rw = rw; - rbi->bi_rw = rw; - if (rw & WRITE) { - bi->bi_end_io = raid5_end_write_request; - rbi->bi_end_io = raid5_end_write_request; - } else - bi->bi_end_io = raid5_end_read_request; - rcu_read_lock(); rrdev = rcu_dereference(conf->disks[i].replacement); smp_mb(); /* Ensure that if rrdev is NULL, rdev won't be */ @@ -643,7 +635,14 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) set_bit(STRIPE_IO_STARTED, &sh->state); + bio_reset(bi); bi->bi_bdev = rdev->bdev; + bi->bi_rw = rw; + bi->bi_end_io = (rw & WRITE) + ? raid5_end_write_request + : raid5_end_read_request; + bi->bi_private = sh; + pr_debug("%s: for %llu schedule op %ld on disc %d\n", __func__, (unsigned long long)sh->sector, bi->bi_rw, i); @@ -657,12 +656,9 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) if (test_bit(R5_ReadNoMerge, &sh->dev[i].flags)) bi->bi_rw |= REQ_FLUSH; - bi->bi_flags = 1 << BIO_UPTODATE; - bi->bi_idx = 0; bi->bi_io_vec[0].bv_len = STRIPE_SIZE; bi->bi_io_vec[0].bv_offset = 0; bi->bi_size = STRIPE_SIZE; - bi->bi_next = NULL; if (rrdev) set_bit(R5_DOUBLE_LOCKED, &sh->dev[i].flags); generic_make_request(bi); @@ -674,7 +670,13 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) set_bit(STRIPE_IO_STARTED, &sh->state); + bio_reset(rbi); rbi->bi_bdev = rrdev->bdev; + rbi->bi_rw = rw; + BUG_ON(!(rw & WRITE)); + rbi->bi_end_io = raid5_end_write_request; + rbi->bi_private = sh; + pr_debug("%s: for %llu schedule op %ld on " "replacement disc %d\n", __func__, (unsigned long long)sh->sector, @@ -686,12 +688,9 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s) else rbi->bi_sector = (sh->sector + rrdev->data_offset); - rbi->bi_flags = 1 << BIO_UPTODATE; - rbi->bi_idx = 0; rbi->bi_io_vec[0].bv_len = STRIPE_SIZE; rbi->bi_io_vec[0].bv_offset = 0; rbi->bi_size = STRIPE_SIZE; - rbi->bi_next = NULL; generic_make_request(rbi); } if (!rdev && !rrdev) {