From patchwork Wed Mar 27 17:39:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kent Overstreet X-Patchwork-Id: 2352481 Return-Path: X-Original-To: patchwork-dm-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by patchwork2.kernel.org (Postfix) with ESMTP id 51262DFE82 for ; Wed, 27 Mar 2013 17:43:59 +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 r2RHfOlP030410; Wed, 27 Mar 2013 13:41:24 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2RHeXfg011560 for ; Wed, 27 Mar 2013 13:40:33 -0400 Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.19]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2RHeWPx009991 for ; Wed, 27 Mar 2013 13:40:32 -0400 Received: from mail-pb0-f52.google.com (mail-pb0-f52.google.com [209.85.160.52]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2RHeVsk029765 for ; Wed, 27 Mar 2013 13:40:31 -0400 Received: by mail-pb0-f52.google.com with SMTP id ma3so5375875pbc.25 for ; Wed, 27 Mar 2013 10:40:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=F/gJrHELGcRNjcBq1PfdSZZe3D1i//OdNMozwU9VXLM=; b=cU/uvIwau+otz+3p8eQIRXI6pyTozp0WE5p0YGylZX22sm8rwK10IedFEuO6oJ5MA/ /PliRQVGIsxeu7ROiC2yOw8gOeI+hdIPz2vyg8uiTZVV0ZzahE0LXAETBCCtpQMSvlUR NrwCgb2nCYNpYq+uxbz+9CTh7flPYYNQlaVE2gd/Bar9wdDQITOfZPJ8VVh2AcV047dO jTNxN9xMvjAPN57DOLrj9sGrmTP/JY/Nexj8dEV3WVHOAJeIKQNoQseUi5btOKbCL/Zp Co1t8/CH9M06I/WMuyQc8f3jbIFfcsDt5Cx8+SlKjiCLfLeJqywq5/Be8Breni0ankJ5 t4hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=F/gJrHELGcRNjcBq1PfdSZZe3D1i//OdNMozwU9VXLM=; b=Qf8JsRreFOimoZuymN37fhGLe/3KGeE6yTjzHRQhTAkgwSFBBwraGqMvZ1cdG/WQNk 1xzEruAHAAorp1u/VTq/51AqRRRrH3uqQzE8clTxKlB0zxdKvbAM+3wgURBK+ObKGh+m S2aseZcBEkuuwCDYkva6rkMTGLEvgUwNIO+KyE4DviNsCCYD5fGL4bY97n/ADEqLRNGe XlRQCr6iFVoCMzb4Os376b6Bt2UtH8J9sepa8EePCAbeX3//5FXh2w4YYtKeUh8lMc0e kOgexaeTuOoRpsM3xLPgGtc3PuBfpryhOH6yRYy3V6T40ku4kkWHSqyFmawzrG8ZiItB N65g== X-Received: by 10.68.254.35 with SMTP id af3mr30391698pbd.176.1364406031140; Wed, 27 Mar 2013 10:40:31 -0700 (PDT) Received: from formenos.mtv.corp.google.com (formenos.mtv.corp.google.com [172.18.126.133]) by mx.google.com with ESMTPS id qd8sm22195440pbc.29.2013.03.27.10.40.29 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Mar 2013 10:40:30 -0700 (PDT) From: Kent Overstreet To: axboe@kernel.dk, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, dm-devel@vger.kernel.org Date: Wed, 27 Mar 2013 10:39:41 -0700 Message-Id: <1364405992-28424-12-git-send-email-koverstreet@google.com> In-Reply-To: <1364405992-28424-1-git-send-email-koverstreet@google.com> References: <1364405992-28424-1-git-send-email-koverstreet@google.com> X-Gm-Message-State: ALoCoQnV64prNcpMnW7gqJdJQDnF3vzk3oPPiehKf89EfQDOg+nf+dl46IOivspnKmrJDPBtMVCf1DcHlFCJoT7HfOeBEG7BE6hmy9Y6l3IjmhMaJsGWXcyDi4oZq8KWT/qbq0y4shGf69wpck9s4TDEAwO/ZstiTK/uzn0bKnw8I9UrgI/06NI2KG57BLtQTX8CMHP6XJ80 X-RedHat-Spam-Score: -4.4 (BAYES_00, DCC_REPUT_00_12, 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.25 X-Scanned-By: MIMEDefang 2.68 on 10.5.110.19 X-loop: dm-devel@redhat.com Cc: tj@kernel.org, Kent Overstreet , dm-devel@redhat.com, Alasdair Kergon Subject: [dm-devel] [PATCH 11/22] dm-io: Convert DM_IO_BVEC -> DM_IO_BIO 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 Can't work with raw biovecs anymore - have to use the bvec_iter primitives which respect bi_bvec_done. Signed-off-by: Kent Overstreet Cc: Alasdair Kergon Cc: dm-devel@redhat.com --- drivers/md/dm-io.c | 31 +++++++++++++++++-------------- drivers/md/dm-raid1.c | 8 ++++---- include/linux/dm-io.h | 4 ++-- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/drivers/md/dm-io.c b/drivers/md/dm-io.c index a6de5c9..c2a6c34 100644 --- a/drivers/md/dm-io.c +++ b/drivers/md/dm-io.c @@ -202,26 +202,29 @@ static void list_dp_init(struct dpages *dp, struct page_list *pl, unsigned offse /* * Functions for getting the pages from a bvec. */ -static void bvec_get_page(struct dpages *dp, +static void bio_get_page(struct dpages *dp, struct page **p, unsigned long *len, unsigned *offset) { - struct bio_vec *bvec = (struct bio_vec *) dp->context_ptr; - *p = bvec->bv_page; - *len = bvec->bv_len; - *offset = bvec->bv_offset; + struct bio *bio = dp->context_ptr; + struct bio_vec bvec = bio_iovec(bio); + *p = bvec.bv_page; + *len = bvec.bv_len; + *offset = bvec.bv_offset; } -static void bvec_next_page(struct dpages *dp) +static void bio_next_page(struct dpages *dp) { - struct bio_vec *bvec = (struct bio_vec *) dp->context_ptr; - dp->context_ptr = bvec + 1; + struct bio *bio = dp->context_ptr; + struct bio_vec bvec = bio_iovec(bio); + + bio_advance(bio, bvec.bv_len); } -static void bvec_dp_init(struct dpages *dp, struct bio_vec *bvec) +static void bio_dp_init(struct dpages *dp, struct bio *bio) { - dp->get_page = bvec_get_page; - dp->next_page = bvec_next_page; - dp->context_ptr = bvec; + dp->get_page = bio_get_page; + dp->next_page = bio_next_page; + dp->context_ptr = bio; } /* @@ -459,8 +462,8 @@ static int dp_init(struct dm_io_request *io_req, struct dpages *dp, list_dp_init(dp, io_req->mem.ptr.pl, io_req->mem.offset); break; - case DM_IO_BVEC: - bvec_dp_init(dp, io_req->mem.ptr.bvec); + case DM_IO_BIO: + bio_dp_init(dp, io_req->mem.ptr.bio); break; case DM_IO_VMA: diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index e3efb91..56e8844 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c @@ -526,8 +526,8 @@ static void read_async_bio(struct mirror *m, struct bio *bio) struct dm_io_region io; struct dm_io_request io_req = { .bi_rw = READ, - .mem.type = DM_IO_BVEC, - .mem.ptr.bvec = bio->bi_io_vec + bio->bi_iter.bi_idx, + .mem.type = DM_IO_BIO, + .mem.ptr.bio = bio, .notify.fn = read_callback, .notify.context = bio, .client = m->ms->io_client, @@ -629,8 +629,8 @@ static void do_write(struct mirror_set *ms, struct bio *bio) struct mirror *m; struct dm_io_request io_req = { .bi_rw = WRITE | (bio->bi_rw & WRITE_FLUSH_FUA), - .mem.type = DM_IO_BVEC, - .mem.ptr.bvec = bio->bi_io_vec + bio->bi_iter.bi_idx, + .mem.type = DM_IO_BIO, + .mem.ptr.bio = bio, .notify.fn = write_callback, .notify.context = bio, .client = ms->io_client, diff --git a/include/linux/dm-io.h b/include/linux/dm-io.h index f4b0aa3..6cf1f62 100644 --- a/include/linux/dm-io.h +++ b/include/linux/dm-io.h @@ -29,7 +29,7 @@ typedef void (*io_notify_fn)(unsigned long error, void *context); enum dm_io_mem_type { DM_IO_PAGE_LIST,/* Page list */ - DM_IO_BVEC, /* Bio vector */ + DM_IO_BIO, DM_IO_VMA, /* Virtual memory area */ DM_IO_KMEM, /* Kernel memory */ }; @@ -41,7 +41,7 @@ struct dm_io_memory { union { struct page_list *pl; - struct bio_vec *bvec; + struct bio *bio; void *vma; void *addr; } ptr;