From patchwork Fri May 4 15:04:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 10380831 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8D43960353 for ; Fri, 4 May 2018 15:04:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EF56290EF for ; Fri, 4 May 2018 15:04:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73DC4294AC; Fri, 4 May 2018 15:04:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBCAB290EF for ; Fri, 4 May 2018 15:04:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751341AbeEDPEt (ORCPT ); Fri, 4 May 2018 11:04:49 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36769 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbeEDPEr (ORCPT ); Fri, 4 May 2018 11:04:47 -0400 Received: by mail-wm0-f65.google.com with SMTP id n10-v6so5385342wmc.1 for ; Fri, 04 May 2018 08:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KfqDLfgqwCMWchWMY6d5Aq/8+jDa+j5dQXCe1Oq41Ng=; b=RVhdCfTbvPnWwYagWiBKCq4/YxuSAIM/89w9f+mndsVi55IN9QJ8cxVlx4FbFU/jDs 252zSHN96DoCWCVOTR7O3r0zVZciF8/2TaTmZcYK+v+579VWGBhPhy9VNcyxoK6uKxxQ AiaRK8f932STvgZwLsPs4MI1HRn02OA0HIwpWJhJjTLibabjcaTmqMIGaJP71vDAWjHt xmSAx3xiQ05aIc3NDwjUetjSgKhIZR9cHL465ZmNLvXkt1ZUa2E4Ldom1A7lZ4rWkucZ BBiyQS82jowOIXA/UL+dpw2gYFUcm/mg1ck3TYY5ubG1mn1yoM0HYwws7H6SgB39wtLg uMaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KfqDLfgqwCMWchWMY6d5Aq/8+jDa+j5dQXCe1Oq41Ng=; b=mSp4ym5lQgP87VjjJUJCOdmfbncpmP8lrKQpMxWf9CPm1IsZFgYvQomUf03ik/62lm qk5AS0zKX5uV5KxdKdQxE2K0Vl+nxDXX32+VPsDFzm962C2FurLrPpNQxMrKkqh9GUom QrhVPyH5d9adaqhpcot3fIis44A8Qfe2iqMvgzy1Z0clxOAw5r7PpYv7K7Ea+NwKeQ2K iUFI9rN0ADWZVtmjWABRcRjjyNtzya6/ME1mJoJFq/rSiEFgOC9+vD6F/PM5uKuk2G/z rcTBUxa+2v+Abg6doVeKwQ5wqMWkYzLQAOoJy04RuFuD8uQcmolOezALO3JZfHbOMmIz Vf+w== X-Gm-Message-State: ALQs6tDO1xcDX3ruQiNj1I4O+tnI35KC2LGdYDhMtkE0cy+7iyFX5j42 s6UiD+D4aTf0X1bmrTbXw4OXj+5m X-Google-Smtp-Source: AB8JxZpJLsGQjN+1q84/O03hI0LsvG97msEjkwBz4iKhzibMayDxlmWI4XEcltdLwVCHkdQ4mZ3izw== X-Received: by 10.28.166.9 with SMTP id p9mr19203597wme.146.1525446286068; Fri, 04 May 2018 08:04:46 -0700 (PDT) Received: from orange.brq.redhat.com. (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id d8-v6sm13040604wrb.52.2018.05.04.08.04.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 May 2018 08:04:44 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Cc: Luis Henriques , Jeff Layton Subject: [PATCH 1/2] libceph: add osd_req_op_extent_osd_data_bvecs() Date: Fri, 4 May 2018 17:04:15 +0200 Message-Id: <1525446256-1882-2-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1525446256-1882-1-git-send-email-idryomov@gmail.com> References: <1525446256-1882-1-git-send-email-idryomov@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP ... and store num_bvecs for client code's convenience. Signed-off-by: Ilya Dryomov Reviewed-by: Jeff Layton --- drivers/block/rbd.c | 4 +++- include/linux/ceph/osd_client.h | 12 ++++++++++-- net/ceph/osd_client.c | 27 +++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 50b9d0f8ac0b..2b4e90d06822 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2369,7 +2369,9 @@ static int rbd_obj_issue_copyup(struct rbd_obj_request *obj_req, u32 bytes) bytes = 0; } osd_req_op_cls_request_data_bvecs(obj_req->osd_req, 0, - obj_req->copyup_bvecs, bytes); + obj_req->copyup_bvecs, + obj_req->copyup_bvec_count, + bytes); switch (obj_req->img_request->op_type) { case OBJ_OP_WRITE: diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index ba3d8c262f8d..b73dd7ebe585 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h @@ -77,7 +77,10 @@ struct ceph_osd_data { u32 bio_length; }; #endif /* CONFIG_BLOCK */ - struct ceph_bvec_iter bvec_pos; + struct { + struct ceph_bvec_iter bvec_pos; + u32 num_bvecs; + }; }; }; @@ -412,6 +415,10 @@ void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *osd_req, struct ceph_bio_iter *bio_pos, u32 bio_length); #endif /* CONFIG_BLOCK */ +void osd_req_op_extent_osd_data_bvecs(struct ceph_osd_request *osd_req, + unsigned int which, + struct bio_vec *bvecs, u32 num_bvecs, + u32 bytes); void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req, unsigned int which, struct ceph_bvec_iter *bvec_pos); @@ -426,7 +433,8 @@ extern void osd_req_op_cls_request_data_pages(struct ceph_osd_request *, bool own_pages); void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req, unsigned int which, - struct bio_vec *bvecs, u32 bytes); + struct bio_vec *bvecs, u32 num_bvecs, + u32 bytes); extern void osd_req_op_cls_response_data_pages(struct ceph_osd_request *, unsigned int which, struct page **pages, u64 length, diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index a2e2c366e063..08b5fc1f90cc 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c @@ -157,10 +157,12 @@ static void ceph_osd_data_bio_init(struct ceph_osd_data *osd_data, #endif /* CONFIG_BLOCK */ static void ceph_osd_data_bvecs_init(struct ceph_osd_data *osd_data, - struct ceph_bvec_iter *bvec_pos) + struct ceph_bvec_iter *bvec_pos, + u32 num_bvecs) { osd_data->type = CEPH_OSD_DATA_TYPE_BVECS; osd_data->bvec_pos = *bvec_pos; + osd_data->num_bvecs = num_bvecs; } #define osd_req_op_data(oreq, whch, typ, fld) \ @@ -237,6 +239,22 @@ void osd_req_op_extent_osd_data_bio(struct ceph_osd_request *osd_req, EXPORT_SYMBOL(osd_req_op_extent_osd_data_bio); #endif /* CONFIG_BLOCK */ +void osd_req_op_extent_osd_data_bvecs(struct ceph_osd_request *osd_req, + unsigned int which, + struct bio_vec *bvecs, u32 num_bvecs, + u32 bytes) +{ + struct ceph_osd_data *osd_data; + struct ceph_bvec_iter it = { + .bvecs = bvecs, + .iter = { .bi_size = bytes }, + }; + + osd_data = osd_req_op_data(osd_req, which, extent, osd_data); + ceph_osd_data_bvecs_init(osd_data, &it, num_bvecs); +} +EXPORT_SYMBOL(osd_req_op_extent_osd_data_bvecs); + void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req, unsigned int which, struct ceph_bvec_iter *bvec_pos) @@ -244,7 +262,7 @@ void osd_req_op_extent_osd_data_bvec_pos(struct ceph_osd_request *osd_req, struct ceph_osd_data *osd_data; osd_data = osd_req_op_data(osd_req, which, extent, osd_data); - ceph_osd_data_bvecs_init(osd_data, bvec_pos); + ceph_osd_data_bvecs_init(osd_data, bvec_pos, 0); } EXPORT_SYMBOL(osd_req_op_extent_osd_data_bvec_pos); @@ -287,7 +305,8 @@ EXPORT_SYMBOL(osd_req_op_cls_request_data_pages); void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req, unsigned int which, - struct bio_vec *bvecs, u32 bytes) + struct bio_vec *bvecs, u32 num_bvecs, + u32 bytes) { struct ceph_osd_data *osd_data; struct ceph_bvec_iter it = { @@ -296,7 +315,7 @@ void osd_req_op_cls_request_data_bvecs(struct ceph_osd_request *osd_req, }; osd_data = osd_req_op_data(osd_req, which, cls, request_data); - ceph_osd_data_bvecs_init(osd_data, &it); + ceph_osd_data_bvecs_init(osd_data, &it, num_bvecs); osd_req->r_ops[which].cls.indata_len += bytes; osd_req->r_ops[which].indata_len += bytes; }