From patchwork Mon Sep 24 22:34:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1500811 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 B34373FE80 for ; Mon, 24 Sep 2012 22:39:14 +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 q8OMbBOt026059; Mon, 24 Sep 2012 18:37: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 q8OMZqJT009224 for ; Mon, 24 Sep 2012 18:35:52 -0400 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8OMZlPW019515 for ; Mon, 24 Sep 2012 18:35:47 -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 q8OMZU56013957 for ; Mon, 24 Sep 2012 18:35:46 -0400 Received: by mail-pb0-f46.google.com with SMTP id rr4so7786683pbb.33 for ; Mon, 24 Sep 2012 15:35:46 -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=crJlHNl5dUPnv/whEoywoRoef+UYh8RaxgAEy/hSRDX1MV4F4O9nEBJhEgByvHSdK+ gTZ+Z+PfIdiBuU7ayq/CpbXJfcIZ/vANp4JZG5E4P3/9CT9HSYMfVLYSyQJIXSEJvRVc qWB4XkGwJ88Jfn1alZE3+OrMIa4f1iPXGkHB+cWZfiyd9/hiTIm5Fet0/12653K9/WGp sYC6pYjzdT4EgnI+ZVFr/Isplpw88nULd7mJrcamkrNb2liXNb/pVv1MwpzGev54Tpi+ wynW75rOOJmJtMmvOI1wFfcyJ0/lJuq1aw3WXVWVRFf1U83RMlhJWiVMYwLUrOcjowaK txdA== 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=eAK+iHGxkmc+8p2jbFoi1J6tqTrd6RBsoimVprnSuO/lOV5p1aI36PHY3/KJX15OGX YXbzZz+kjg8TDR3xBCljAhLTvgKLaOzqjvbG1Vl05bQrLfgaeFtUb/giXG3OIxMKC4/b 1TpZc5jRYDc7rfa1iZUYNWZdl4DgvYl42da5/olbgzU37kTJLBHAFE4oQMrbonMr/sH+ 3TCbmrE1cFTQGpBuMyg4/v4gJh/IogecaR2/bZY1aulivIoNssucO7BvP0xl/EzRt1qd sxAX/JO48zFfx5pIS2ZhtBtLEm2mQhDqU1XWfLCRCAyb7bt+XpIWegvYUNyweubjwP8y p94g== Received: by 10.68.136.229 with SMTP id qd5mr8223456pbb.154.1348526146656; Mon, 24 Sep 2012 15:35:46 -0700 (PDT) Received: by 10.68.136.229 with SMTP id qd5mr8223438pbb.154.1348526146579; Mon, 24 Sep 2012 15:35:46 -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.45 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Sep 2012 15:35:46 -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:54 -0700 Message-Id: <1348526106-17074-15-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: ALoCoQnh09SrUXw4G4S2oaMHcCFy78rcFLUHwy7kWtPV8Y/QYRFJfe2srSZAutIV6g2AE804uymjBvpJ5xrknrnbcgvnMkUqQGMHvnh7/SZcGceXnwqnoOWpzpK0Ht4HewDRnHJDUEMR7lpcCNicxD2TXioxHehuDlKa+vD2O1r/cx4CCfWCg7xKmGV+7Hh1ORXluwx+Zs9R 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.67 on 10.5.11.11 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 14/26] 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) {