From patchwork Fri Jul 1 10:30:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 586341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1183C43334 for ; Fri, 1 Jul 2022 10:30:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236215AbiGAKaV (ORCPT ); Fri, 1 Jul 2022 06:30:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234063AbiGAKaS (ORCPT ); Fri, 1 Jul 2022 06:30:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA20674DD6 for ; Fri, 1 Jul 2022 03:30:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 78941623F6 for ; Fri, 1 Jul 2022 10:30:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8077EC341C7; Fri, 1 Jul 2022 10:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656671416; bh=7lu1NmQ3dfpDfRmRrdtOHXQ11t4/0PpWnTw53ubzifw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VVMf88sY6+r17UbVNCOfCaG0h9sf9J7Pt75+Mb6ZzM4BFkfhxtMsLfDtYiWJf5+97 S6YVJCJMUikwDjekRdD3AegJlJCjFjadn5t9hj66J0yOBbJYZRvPMNDFhL6g1IIRnQ RIjp0gTs7s6hZ68xsg7pROSSuWZ6WOJR+y3mBg2gWfDYlYho8pqJNe28MRip+GYPYv QyLr6a45obZuwI2wuFHxqB0XpARiKh3OCbmzgwwG/Wpg6T0jHcv/W9kc+7O1aiMzGM EG7kdKFHy1FcZ0dmm153GnxfdYWvG6M5blk2+vsqBLnvicnKCZFeUomC0sdq8rODXG JGv2zWimASHYA== From: Jeff Layton To: xiubli@redhat.com, idryomov@gmail.com Cc: ceph-devel@vger.kernel.org Subject: [PATCH v3 2/2] ceph: use osd_req_op_extent_osd_iter for netfs reads Date: Fri, 1 Jul 2022 06:30:13 -0400 Message-Id: <20220701103013.12902-3-jlayton@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220701103013.12902-1-jlayton@kernel.org> References: <20220701103013.12902-1-jlayton@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The netfs layer has already pinned the pages involved before calling issue_op, so we can just pass down the iter directly instead of calling iov_iter_get_pages_alloc. Instead of having to allocate a page array, use CEPH_MSG_DATA_ITER and pass it the iov_iter directly to clone. Signed-off-by: Jeff Layton --- fs/ceph/addr.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 66dc7844fcc6..e44a3eefb344 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -220,7 +220,6 @@ static void finish_netfs_read(struct ceph_osd_request *req) struct ceph_osd_data *osd_data = osd_req_op_extent_osd_data(req, 0); struct netfs_io_subrequest *subreq = req->r_priv; struct ceph_osd_req_op *op = &req->r_ops[0]; - int num_pages; int err = req->r_result; bool sparse = (op->op == CEPH_OSD_OP_SPARSE_READ); @@ -242,9 +241,6 @@ static void finish_netfs_read(struct ceph_osd_request *req) __set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags); netfs_subreq_terminated(subreq, err, false); - - num_pages = calc_pages_for(osd_data->alignment, osd_data->length); - ceph_put_page_vector(osd_data->pages, num_pages, false); iput(req->r_inode); } @@ -312,8 +308,6 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) struct ceph_osd_request *req; struct ceph_vino vino = ceph_vino(inode); struct iov_iter iter; - struct page **pages; - size_t page_off; int err = 0; u64 len = subreq->len; bool sparse = ceph_test_mount_opt(fsc, SPARSEREAD); @@ -341,17 +335,7 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) dout("%s: pos=%llu orig_len=%zu len=%llu\n", __func__, subreq->start, subreq->len, len); iov_iter_xarray(&iter, READ, &rreq->mapping->i_pages, subreq->start, len); - err = iov_iter_get_pages_alloc(&iter, &pages, len, &page_off); - if (err < 0) { - dout("%s: iov_ter_get_pages_alloc returned %d\n", __func__, err); - goto out; - } - - /* should always give us a page-aligned read */ - WARN_ON_ONCE(page_off); - len = err; - - osd_req_op_extent_osd_data_pages(req, 0, pages, len, 0, false, false); + osd_req_op_extent_osd_iter(req, 0, &iter); req->r_callback = finish_netfs_read; req->r_priv = subreq; req->r_inode = inode;