From patchwork Mon Oct 15 20:08:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 1595911 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 0F1233FD86 for ; Mon, 15 Oct 2012 20:14:40 +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 q9FKBEhg010287; Mon, 15 Oct 2012 16:11:14 -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 q9FKAPXK027030 for ; Mon, 15 Oct 2012 16:10:25 -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 q9FKAHVe026620 for ; Mon, 15 Oct 2012 16:10:17 -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 q9FK9qea013584 for ; Mon, 15 Oct 2012 16:10:16 -0400 Received: by mail-pa0-f46.google.com with SMTP id hz1so5214261pad.33 for ; Mon, 15 Oct 2012 13:10:11 -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=eWoCfk/YOjc7PAfloJkWw4vF+N4iRzHeHL7kLANHdDY=; b=mjAZ4s63I+vUZkmlepxkCpffLk+th7/bJYR0GIrwDdpBQOV3NObXFcmSx1htfI1KTe 3/N2H+Ks4dE1qJCsc9UlvT6/s58Ay1EfY+WypfZHCTAwV6L7vDmsjWE/j4AX4IoONNyZ kL2MOYgDghRNbDlYdXDsQOF1uLGUXU/bi+wb/kaUx6mAj00tl3nsuQYw2dkcey7gzg9o s1vIq1rY/3JF2gz9mfDW00Ko6ZCib81z/2xjgLmJt4jvogKD6CEh3R3aPmVrJ0nkPErP slhVxmR9lUeEwBVz87/eNwH2jGPa5GHfCoyfiLx6llG+aER/jBo/6kxnCj7993l+D1XA 7Nsg== 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=eWoCfk/YOjc7PAfloJkWw4vF+N4iRzHeHL7kLANHdDY=; b=K+VDfX9MnbEmdIx/5PrBKq8+2HafVDHArzBx/D0qRo12iTNIysrl1qSIjYiLdaxpv3 QA/RkeCEpIrLXtqH6iELVFjvVP/6NoAfQbGv9s6igkWQkR+FJMp+9adZkwmIsz/4GFHH 6R8kbodPGK/VB+OxglD2UHYA1pwoUZzy04WEhsV0xL31I3plss9iwWSmQWCuLFVe5tTp Fq4KLQywLTyIDbDx0ZzBCmLJ9iArkWlDn+CTz8pLkfVl+7a94wL3OJrQ6fvpKlYDqNeQ VA2YnxtjzRbdzbR4MkANpNnPpwU0ibtFhlcb1Cnu72wgLta46Z7OGqWCArPxZqcmqbht iPVg== Received: by 10.68.217.201 with SMTP id pa9mr40351710pbc.45.1350331811823; Mon, 15 Oct 2012 13:10:11 -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.09 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 15 Oct 2012 13:10:10 -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:50 -0700 Message-Id: <1350331769-14856-17-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: ALoCoQlyaddfKbBIQSS+vJdl2lhMsp5Ajf04qgalB5PLSpdzqRPvqP2nW0yHHQ9HMqqlWtHYzPg5Qgskzxg3BpqAFcWMRKd7hml6tpplyBv8PG80wJmx/f+58W64mqp/Nh17W60x7Ek7pYkijqvfo8Sbd5KgbgpRZN1n9fxDuy6mf7NFYiR97QFln4BfimPjY6VxoEpn3QAn 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.23 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: axboe@kernel.dk, Jiri Kosina , Kent Overstreet , tj@kernel.org, vgoyal@redhat.com Subject: [dm-devel] [PATCH v4 16/24] pktcdvd: Use bio_reset() in disabled code to kill bi_idx usage 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 In the short term this'll help with code auditing, and if this code ever gets used now it's converted :) Signed-off-by: Kent Overstreet CC: Jiri Kosina --- drivers/block/pktcdvd.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 783c96c..1119042 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -1156,16 +1156,15 @@ static int pkt_start_recovery(struct packet_data *pkt) new_sector = new_block * (CD_FRAMESIZE >> 9); pkt->sector = new_sector; + bio_reset(pkt->bio); + pkt->bio->bi_bdev = pd->bdev; + pkt->bio->bi_rw = REQ_WRITE; pkt->bio->bi_sector = new_sector; - pkt->bio->bi_next = NULL; - pkt->bio->bi_flags = 1 << BIO_UPTODATE; - pkt->bio->bi_idx = 0; - - BUG_ON(pkt->bio->bi_rw != REQ_WRITE); - BUG_ON(pkt->bio->bi_vcnt != pkt->frames); - BUG_ON(pkt->bio->bi_size != pkt->frames * CD_FRAMESIZE); - BUG_ON(pkt->bio->bi_end_io != pkt_end_io_packet_write); - BUG_ON(pkt->bio->bi_private != pkt); + pkt->bio->bi_size = pkt->frames * CD_FRAMESIZE; + pkt->bio->bi_vcnt = pkt->frames; + + pkt->bio->bi_end_io = pkt_end_io_packet_write; + pkt->bio->bi_private = pkt; drop_super(sb); return 1;