From patchwork Thu Apr 25 07:04:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10916087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 90593161F for ; Thu, 25 Apr 2019 07:05:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8162F288E8 for ; Thu, 25 Apr 2019 07:05:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 75BC92892A; Thu, 25 Apr 2019 07:05:06 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 2098A288E8 for ; Thu, 25 Apr 2019 07:05:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387513AbfDYHFF (ORCPT ); Thu, 25 Apr 2019 03:05:05 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46746 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387404AbfDYHFF (ORCPT ); Thu, 25 Apr 2019 03:05:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2TwHWgFVVH75HO3UajTc6bZCO6+yc3fIfCxTvkcUst0=; b=oLHlAvqZGL3g3AtLZOr83KZNko Q3XZzdW+G1N7fBoHtqG4Czs8hOzwDk3BJNXBTWjhB89cjhwMVBnufvwJEr+EkPNDutM/nSCcgOQdl W+AfiYVGA39BsKpyUBgQdjt706c4TwnKhe9M8wmRcUv1kEXQaGGZP2oNEn82ccLNhAU1WdSAvrCFU /aNNlHNE/Nq4s9diAEeC/wtDWKu9syg8Wn0519MOSSMnMvw+GUNRzZczYiUm+fIBmxrcyHBLFVc6k Vh4hGPalS9kKH5buPWCLB0w9LdsyZ7TLrImNbgfnCXAXZhaVmqCVuZTcSx0FyFqecCqw6xRLDJJgn 3PDO5LmA==; Received: from 213-225-37-80.nat.highway.a1.net ([213.225.37.80] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJYRM-0006Td-QP; Thu, 25 Apr 2019 07:05:05 +0000 From: Christoph Hellwig To: Jens Axboe Cc: linux-block@vger.kernel.org Subject: [PATCH 1/3] block: remove the __bio_add_pc_page export Date: Thu, 25 Apr 2019 09:04:33 +0200 Message-Id: <20190425070435.3478-2-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190425070435.3478-1-hch@lst.de> References: <20190425070435.3478-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The same page optimization is a rather odd corner case, which is not used outside bio.c and which really should not be used outside of bio.c either - we have better highlevel helpers like the rq/bio mapping helpers. Signed-off-by: Christoph Hellwig --- block/bio.c | 3 +-- include/linux/bio.h | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/block/bio.c b/block/bio.c index 9ad0d00cdc9b..e717b303e1fb 100644 --- a/block/bio.c +++ b/block/bio.c @@ -709,7 +709,7 @@ static bool can_add_page_to_seg(struct request_queue *q, * * This should only be used by passthrough bios. */ -int __bio_add_pc_page(struct request_queue *q, struct bio *bio, +static int __bio_add_pc_page(struct request_queue *q, struct bio *bio, struct page *page, unsigned int len, unsigned int offset, bool put_same_page) { @@ -776,7 +776,6 @@ int __bio_add_pc_page(struct request_queue *q, struct bio *bio, bio_set_flag(bio, BIO_SEG_VALID); return len; } -EXPORT_SYMBOL(__bio_add_pc_page); int bio_add_pc_page(struct request_queue *q, struct bio *bio, struct page *page, unsigned int len, unsigned int offset) diff --git a/include/linux/bio.h b/include/linux/bio.h index 186b2723c61b..077cecdf9437 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -435,9 +435,6 @@ void bio_chain(struct bio *, struct bio *); extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int); extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, unsigned int, unsigned int); -extern int __bio_add_pc_page(struct request_queue *, struct bio *, - struct page *, unsigned int, unsigned int, - bool); bool __bio_try_merge_page(struct bio *bio, struct page *page, unsigned int len, unsigned int off, bool same_page); void __bio_add_page(struct bio *bio, struct page *page, From patchwork Thu Apr 25 07:04:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10916089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49ADB161F for ; Thu, 25 Apr 2019 07:05:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F9B52892A for ; Thu, 25 Apr 2019 07:05:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 24272289B0; Thu, 25 Apr 2019 07:05:10 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 EE3D62892A for ; Thu, 25 Apr 2019 07:05:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387568AbfDYHFI (ORCPT ); Thu, 25 Apr 2019 03:05:08 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46754 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387404AbfDYHFI (ORCPT ); Thu, 25 Apr 2019 03:05:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=A38pfHu3fvqUv9Advx7YCNtFlo6QWdNsrSzHGAUggAk=; b=nydSkczPSN4UFUwIs+kw6s2XSK jgjTBME2ob2m/X9jBhj03srn16hVOh5Q8Lk8m8SLWeWkCAnNwVbU3LvbOn6QxqJQD/Ho820nhCbWB lHLRgaGPptiG2Sb/uomCLBhvubwP5IWupWgRc1q3peGk7O9hqJ+wr/TyqADtLJbt2QO2oY7LhkS4W FGmsR/yQ/fkY4NtZNKNtkj7HQdehB5a85WF1eGopk2wqOLPxWVPe2P7irq0v9t+BUWCSHEnlf9t1z zNQZclBkNyhNI1/DIozNpI7Sw1RVf4E1oDk5A4MgIwWpKO9f0XaquVVO5o+w2kaNF9yLE+v3hexVY eke8opww==; Received: from 213-225-37-80.nat.highway.a1.net ([213.225.37.80] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJYRP-0006z1-JK; Thu, 25 Apr 2019 07:05:08 +0000 From: Christoph Hellwig To: Jens Axboe Cc: linux-block@vger.kernel.org Subject: [PATCH 2/3] block: remove bogus comments in __bio_add_pc_page Date: Thu, 25 Apr 2019 09:04:34 +0200 Message-Id: <20190425070435.3478-3-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190425070435.3478-1-hch@lst.de> References: <20190425070435.3478-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We are never called with file system pages by defintions for the passthrough interface, and we also never undo any addition later these days. Signed-off-by: Christoph Hellwig --- block/bio.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/block/bio.c b/block/bio.c index e717b303e1fb..de26dc18bceb 100644 --- a/block/bio.c +++ b/block/bio.c @@ -724,11 +724,6 @@ static int __bio_add_pc_page(struct request_queue *q, struct bio *bio, if (((bio->bi_iter.bi_size + len) >> 9) > queue_max_hw_sectors(q)) return 0; - /* - * For filesystems with a blocksize smaller than the pagesize - * we will often be called with the same page as last time and - * a consecutive offset. Optimize this special case. - */ if (bio->bi_vcnt > 0) { bvec = &bio->bi_io_vec[bio->bi_vcnt - 1]; @@ -760,10 +755,6 @@ static int __bio_add_pc_page(struct request_queue *q, struct bio *bio, if (bio->bi_phys_segments >= queue_max_segments(q)) return 0; - /* - * setup the new entry, we might clear it again later if we - * cannot add the page - */ bvec = &bio->bi_io_vec[bio->bi_vcnt]; bvec->bv_page = page; bvec->bv_len = len; From patchwork Thu Apr 25 07:04:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10916091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 035D314DB for ; Thu, 25 Apr 2019 07:05:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E7010288FC for ; Thu, 25 Apr 2019 07:05:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7299289B0; Thu, 25 Apr 2019 07:05:11 +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.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 7AFBD288FC for ; Thu, 25 Apr 2019 07:05:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387413AbfDYHFL (ORCPT ); Thu, 25 Apr 2019 03:05:11 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46768 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387404AbfDYHFK (ORCPT ); Thu, 25 Apr 2019 03:05:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xQ73h+2avdn47Cr/SP1ZrNFYanI/xoT9mgADZCKrD+o=; b=r+u05aZZ1qBNM63tI+fbyZTD4L AYYkmiG+EWHdvdgY5tW7H/z5CVE1i00f4Gni/q1VWygyFuxa/bNjkjzxXjUYTQHyy5WH0hc5iGp3Y B0KBhp6smr9nvtm6eeROZRDQs71WNvIP6EIJF5SWKk2Roiq1wO/H7FVMnMLUri8Bw7/aMPJz7qnoh TYYhYYWH2Cmzjt+sWh+fqMdZUqMD/+CKquojJOL/crbjjpANUE3jGvVDjrwdxl5gcsYS40t1/zHDs WwKYrZ6vLDIzhLY8+nL+zQbH2xBiO1X07zdoPdQTOq5rPend3dyKock0fEQ5GURAkm07wYMJheFeH 4u2PqIVQ==; Received: from 213-225-37-80.nat.highway.a1.net ([213.225.37.80] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJYRS-0007Wp-58; Thu, 25 Apr 2019 07:05:10 +0000 From: Christoph Hellwig To: Jens Axboe Cc: linux-block@vger.kernel.org Subject: [PATCH 3/3] block: clean up __bio_add_pc_page a bit Date: Thu, 25 Apr 2019 09:04:35 +0200 Message-Id: <20190425070435.3478-4-hch@lst.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190425070435.3478-1-hch@lst.de> References: <20190425070435.3478-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Share the bi_size update by moving the done label up, and duplicate the bv_len update in the two callers to get rid of the bvec_merge label. Signed-off-by: Christoph Hellwig --- block/bio.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/block/bio.c b/block/bio.c index de26dc18bceb..029afb121a48 100644 --- a/block/bio.c +++ b/block/bio.c @@ -731,9 +731,7 @@ static int __bio_add_pc_page(struct request_queue *q, struct bio *bio, offset == bvec->bv_offset + bvec->bv_len) { if (put_same_page) put_page(page); - bvec_merge: bvec->bv_len += len; - bio->bi_iter.bi_size += len; goto done; } @@ -745,8 +743,10 @@ static int __bio_add_pc_page(struct request_queue *q, struct bio *bio, return 0; if (page_is_mergeable(bvec, page, len, offset, false) && - can_add_page_to_seg(q, bvec, page, len, offset)) - goto bvec_merge; + can_add_page_to_seg(q, bvec, page, len, offset)) { + bvec->bv_len += len; + goto done; + } } if (bio_full(bio)) @@ -760,9 +760,8 @@ static int __bio_add_pc_page(struct request_queue *q, struct bio *bio, bvec->bv_len = len; bvec->bv_offset = offset; bio->bi_vcnt++; - bio->bi_iter.bi_size += len; - done: + bio->bi_iter.bi_size += len; bio->bi_phys_segments = bio->bi_vcnt; bio_set_flag(bio, BIO_SEG_VALID); return len;