From patchwork Mon Oct 15 20:09:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1595821 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 AABEB3FD86 for ; Mon, 15 Oct 2012 20:14:19 +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 q9FKBNla010396; Mon, 15 Oct 2012 16:11:23 -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 q9FKAql0027257 for ; Mon, 15 Oct 2012 16:10:52 -0400 Received: from mx1.redhat.com (ext-mx16.extmail.prod.ext.phx2.redhat.com [10.5.110.21]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9FKAlBB004938 for ; Mon, 15 Oct 2012 16:10:47 -0400 Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9FK9gLI018945 for ; Mon, 15 Oct 2012 16:10:45 -0400 Received: by mail-pa0-f46.google.com with SMTP id hz1so5214109pad.33 for ; Mon, 15 Oct 2012 13:10: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=6yJV6Dhp+v2iiTvgycFXLOWejo0qDuhEMgdbALoAXCg=; b=Zxuwu/Vrc6YTNd+mpbhsD935SCipulvS3SGLUDbhB5Lqjx43kgrxSGcuFnXebukKB+ oZWH/1n4iPPYl47F0HpwX2LaTb/S54t2Mh9EGSthGBut27Nf1yktMxEaBvNxlhWaR8uh RUSwrEwsTOAP+5j/eAxWvNKfsZF+6JEULkfTAHv3NtOrL9+53T1iEgrxrA1N8In9+iVh QaGXBqsG8hDFyjhOS9Zg97STMEOSD+V+HW529zd1XiY/BzDP55W/JUxK5xVd2V8LS57z rsTjuEG3U/XIx90bC/ZyniitxsMoO8C+3Az4+UMhvp1ClJMZPANptr0t38hEcM+KhqdB yVvw== 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=6yJV6Dhp+v2iiTvgycFXLOWejo0qDuhEMgdbALoAXCg=; b=ZXEMIwHvsUQKjzo1i9WIl/dIOduhlf4iWRvqNjp4OU+4lyoYXERm1+CxSnjeKTsWKB 2rqx3lE/S4mHQubY8zFunCjllOdyClQiHvhF/CeHLrFMAtuR3yrWuna6azG9lPtF9Njn gJmMB6tSj7EwcaGtzBVKyvv+7l9QF8hm5E+kVK2Hsa9wOR0JlgJVf+ZTvVx81vQbu+MU CkRY+dtVA6Nc12ff8PydiY5aos4afJGuT7eFv1LRbJ0mj0Kt5I/SOgoIJkEa8tC3slTx iIKhRkoxvMDNckU2l8pHwxt6/TwtmeqNelymEwqOiBDXLibwbdrkZfXlNCfHkX6RmSH+ viPg== Received: by 10.68.213.1 with SMTP id no1mr40151384pbc.123.1350331845743; Mon, 15 Oct 2012 13:10: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 k9sm3021703paz.22.2012.10.15.13.10.44 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 13:10:45 -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:16 -0700 Message-Id: <1350331769-14856-43-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: ALoCoQkk/1fhZCUy3UBhj8TDvqCY3z6aKf4kXFA0t3Jdp9oJrG7lAA6fFOUt8/xa9197YG//G9lNCNiWwisUcavdSa8EVJ+x9073qrSkT159rCfhvCAMyNbDIGsRPGoONPW6JpCVWHB5fPx6xzCMcXrIxT23Tp6ILhYXfrOnBko32tWh7fICWwDG99lxmP5gwgoPJrgoFgFg 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.21 X-loop: dm-devel@redhat.com Cc: tj@kernel.org, axboe@kernel.dk, Kent Overstreet Subject: [dm-devel] [PATCH v2 13/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 | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 7c19dbe..ebe43f7 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,14 @@ 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; + rbi->bi_end_io = (rw & WRITE) + ? raid5_end_write_request + : raid5_end_read_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 +689,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) {