From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8D61C3A5A4 for ; Sun, 1 Sep 2019 05:53:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE60B233A2 for ; Sun, 1 Sep 2019 05:53:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=aol.com header.i=@aol.com header.b="mXDvfj5D" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726940AbfIAFxG (ORCPT ); Sun, 1 Sep 2019 01:53:06 -0400 Received: from sonic314-21.consmr.mail.gq1.yahoo.com ([98.137.69.84]:34098 "EHLO sonic314-21.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725263AbfIAFxG (ORCPT ); Sun, 1 Sep 2019 01:53:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1567317185; bh=A0DY0dOyy+x6psHQtnucMUPA/7zTLDXv/4VtOvMsf7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject; b=mXDvfj5DLqqp2xN98RuZh5ifhIEu8g+bNGW9bl58VtF1P+86CIukUCl1H8ZOLWFPbEMpqahqk9aVCPDO2UY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8kl3LdeaNZu_FYxiU5n qLFLV72ACbRMDIOGroehQu16cDjyZhKKtRQZ9Y_7XRkbkJPwsAYob89BQv0LYDFH.YaWQr__eaqP 0UlOOGAs9r98K_TEYadFTf.01c3yWEBeDwHPyY9QfWXBwobSohQVG5li4zc6BUJmuR8pyDThzDSg td8SjfUd5Y0Zk9XTb633gl0WnzIkVBzzz3QbmUzEObGKVI7Cu7TSeji234KmfPSSzY5LWwU0lL.o bfN58UQ2rm7ss8XAB8Ws65eovCKz1DvROqy43IKST.zBrMeKZsg0p4n96Wic_C_1iHu1WbIRU_XZ zoCCud.dzxiVSYtBVuMs8PVgc1qKTHzWEcwrRdO4v3Y2Zw_nD8_JXsssoqaW2ctNPCQoQkDFG7vW Zx23Y22cbGqpkBY0XJNKFK1p9WNDj9xaAXxjhlHWHEVf5hz08iRbNZYBEtD2d2vFCbb2ggW9NGBD e_oAV8CXJGwa_6bFWH_fq9p.bW5Z.3quzw88g2BFgckDqOMnFHA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.gq1.yahoo.com with HTTP; Sun, 1 Sep 2019 05:53:05 +0000 Received: by smtp406.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 426e3b5ec1af9e36f409445c51071a70; Sun, 01 Sep 2019 05:53:03 +0000 (UTC) From: Gao Xiang To: Christoph Hellwig , Chao Yu , Greg Kroah-Hartman Cc: linux-fsdevel@vger.kernel.org, devel@driverdev.osuosl.org, linux-erofs@lists.ozlabs.org, Chao Yu , Gao Xiang Subject: [PATCH 15/21] erofs: kill __submit_bio() Date: Sun, 1 Sep 2019 13:51:24 +0800 Message-Id: <20190901055130.30572-16-hsiangkao@aol.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190901055130.30572-1-hsiangkao@aol.com> References: <20190802125347.166018-1-gaoxiang25@huawei.com> <20190901055130.30572-1-hsiangkao@aol.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: Gao Xiang As Christoph pointed out [1], " Why is there __submit_bio which really just obsfucates what is going on? Also why is __submit_bio using bio_set_op_attrs instead of opencode it as the comment right next to it asks you to? " Let's use submit_bio directly instead. [1] https://lore.kernel.org/lkml/20190830162812.GA10694@infradead.org/ Reported-by: Christoph Hellwig Signed-off-by: Gao Xiang --- fs/erofs/data.c | 15 ++++++++------- fs/erofs/internal.h | 9 ++------- fs/erofs/zdata.c | 6 +++--- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index 837b07cd2761..d3cd7a453648 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -57,14 +57,15 @@ struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr) if (!PageUptodate(page)) { struct bio *bio; - bio = erofs_grab_bio(sb, blkaddr, 1, sb, read_endio); + bio = erofs_grab_bio(sb, REQ_OP_READ | REQ_META, + blkaddr, 1, sb, read_endio); if (bio_add_page(bio, page, PAGE_SIZE, 0) != PAGE_SIZE) { err = -EFAULT; goto err_out; } - __submit_bio(bio, REQ_OP_READ, REQ_META); + submit_bio(bio); lock_page(page); /* this page has been truncated by others */ @@ -188,7 +189,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, /* not continuous */ *last_block + 1 != current_block) { submit_bio_retry: - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); bio = NULL; } @@ -258,7 +259,8 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, if (nblocks > BIO_MAX_PAGES) nblocks = BIO_MAX_PAGES; - bio = erofs_grab_bio(sb, blknr, nblocks, sb, read_endio); + bio = erofs_grab_bio(sb, REQ_OP_READ, blknr, nblocks, + sb, read_endio); } err = bio_add_page(bio, page, PAGE_SIZE, 0); @@ -289,8 +291,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, /* if updated manually, continuous pages has a gap */ if (bio) submit_bio_out: - __submit_bio(bio, REQ_OP_READ, 0); - + submit_bio(bio); return err ? ERR_PTR(err) : NULL; } @@ -354,7 +355,7 @@ static int erofs_raw_access_readpages(struct file *filp, /* the rare case (end in gaps) */ if (bio) - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); return 0; } diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 40d4dd47bb7a..15545959af92 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -406,6 +406,7 @@ static inline int z_erofs_map_blocks_iter(struct inode *inode, /* data.c */ static inline struct bio *erofs_grab_bio(struct super_block *sb, + unsigned int bi_opf, erofs_blk_t blkaddr, unsigned int nr_pages, void *bi_private, bio_end_io_t endio) @@ -416,16 +417,10 @@ static inline struct bio *erofs_grab_bio(struct super_block *sb, bio_set_dev(bio, sb->s_bdev); bio->bi_iter.bi_sector = (sector_t)blkaddr << LOG_SECTORS_PER_BLOCK; bio->bi_private = bi_private; + bio->bi_opf = bi_opf; return bio; } -static inline void __submit_bio(struct bio *bio, unsigned int op, - unsigned int op_flags) -{ - bio_set_op_attrs(bio, op, op_flags); - submit_bio(bio); -} - struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr); int erofs_map_blocks(struct inode *, struct erofs_map_blocks *, int); diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index abe28565d6c0..ce1a0f2997a9 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1258,12 +1258,12 @@ static bool z_erofs_vle_submit_all(struct super_block *sb, if (bio && force_submit) { submit_bio_retry: - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); bio = NULL; } if (!bio) { - bio = erofs_grab_bio(sb, first_index + i, + bio = erofs_grab_bio(sb, REQ_OP_READ, first_index + i, BIO_MAX_PAGES, bi_private, z_erofs_vle_read_endio); ++nr_bios; @@ -1286,7 +1286,7 @@ static bool z_erofs_vle_submit_all(struct super_block *sb, } while (owned_head != Z_EROFS_PCLUSTER_TAIL); if (bio) - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); if (postsubmit_is_all_bypassed(q, nr_bios, force_fg)) return true; -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1F25C3A5A4 for ; Sun, 1 Sep 2019 05:53:12 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9302B21744 for ; Sun, 1 Sep 2019 05:53:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=aol.com header.i=@aol.com header.b="mXDvfj5D" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9302B21744 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=aol.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 831C786C1A; Sun, 1 Sep 2019 05:53:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hQORqsaTKXxJ; Sun, 1 Sep 2019 05:53:11 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 4309E86917; Sun, 1 Sep 2019 05:53:11 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id C25F71BF97C for ; Sun, 1 Sep 2019 05:53:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id BF65985BA9 for ; Sun, 1 Sep 2019 05:53:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZvpB-SZ0qwzr for ; Sun, 1 Sep 2019 05:53:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sonic314-21.consmr.mail.gq1.yahoo.com (sonic314-21.consmr.mail.gq1.yahoo.com [98.137.69.84]) by hemlock.osuosl.org (Postfix) with ESMTPS id 4026F86887 for ; Sun, 1 Sep 2019 05:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1567317185; bh=A0DY0dOyy+x6psHQtnucMUPA/7zTLDXv/4VtOvMsf7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject; b=mXDvfj5DLqqp2xN98RuZh5ifhIEu8g+bNGW9bl58VtF1P+86CIukUCl1H8ZOLWFPbEMpqahqk9aVCPDO2UYw8eUGe1QuntRsMQAkHKT7dic75qHlWW0NvqcITHqnJPkc8w6hLd4pTtLeREzbxK7OPX/2nMdTFiEQsXVbRCIuxiufo8YUjYEG+YmJkls1XG52M+VjQqU4iqepUDz9HB86tmkW9+XWr7qYtR4p9/mAww4w+jLJ/fEpTfSvWy8YVk10Kk6lemC1907+hz0M4HFu76MNRLkmo+u0Yy3474p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UzEObGKVI7Cu7TSeji234KmfPSSzY5LWwU0lL.o bfN58UQ2rm7ss8XAB8Ws65eovCKz1DvROqy43IKST.zBrMeKZsg0p4n96Wic_C_1iHu1WbIRU_XZ zoCCud.dzxiVSYtBVuMs8PVgc1qKTHzWEcwrRdO4v3Y2Zw_nD8_JXsssoqaW2ctNPCQoQkDFG7vW Zx23Y22cbGqpkBY0XJNKFK1p9WNDj9xaAXxjhlHWHEVf5hz08iRbNZYBEtD2d2vFCbb2ggW9NGBD e_oAV8CXJGwa_6bFWH_fq9p.bW5Z.3quzw88g2BFgckDqOMnFHA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.gq1.yahoo.com with HTTP; Sun, 1 Sep 2019 05:53:05 +0000 Received: by smtp406.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 426e3b5ec1af9e36f409445c51071a70; Sun, 01 Sep 2019 05:53:03 +0000 (UTC) From: Gao Xiang To: Christoph Hellwig , Chao Yu , Greg Kroah-Hartman Subject: [PATCH 15/21] erofs: kill __submit_bio() Date: Sun, 1 Sep 2019 13:51:24 +0800 Message-Id: <20190901055130.30572-16-hsiangkao@aol.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190901055130.30572-1-hsiangkao@aol.com> References: <20190802125347.166018-1-gaoxiang25@huawei.com> <20190901055130.30572-1-hsiangkao@aol.com> X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fsdevel@vger.kernel.org, devel@driverdev.osuosl.org, Chao Yu , linux-erofs@lists.ozlabs.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" From: Gao Xiang As Christoph pointed out [1], " Why is there __submit_bio which really just obsfucates what is going on? Also why is __submit_bio using bio_set_op_attrs instead of opencode it as the comment right next to it asks you to? " Let's use submit_bio directly instead. [1] https://lore.kernel.org/lkml/20190830162812.GA10694@infradead.org/ Reported-by: Christoph Hellwig Signed-off-by: Gao Xiang --- fs/erofs/data.c | 15 ++++++++------- fs/erofs/internal.h | 9 ++------- fs/erofs/zdata.c | 6 +++--- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index 837b07cd2761..d3cd7a453648 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -57,14 +57,15 @@ struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr) if (!PageUptodate(page)) { struct bio *bio; - bio = erofs_grab_bio(sb, blkaddr, 1, sb, read_endio); + bio = erofs_grab_bio(sb, REQ_OP_READ | REQ_META, + blkaddr, 1, sb, read_endio); if (bio_add_page(bio, page, PAGE_SIZE, 0) != PAGE_SIZE) { err = -EFAULT; goto err_out; } - __submit_bio(bio, REQ_OP_READ, REQ_META); + submit_bio(bio); lock_page(page); /* this page has been truncated by others */ @@ -188,7 +189,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, /* not continuous */ *last_block + 1 != current_block) { submit_bio_retry: - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); bio = NULL; } @@ -258,7 +259,8 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, if (nblocks > BIO_MAX_PAGES) nblocks = BIO_MAX_PAGES; - bio = erofs_grab_bio(sb, blknr, nblocks, sb, read_endio); + bio = erofs_grab_bio(sb, REQ_OP_READ, blknr, nblocks, + sb, read_endio); } err = bio_add_page(bio, page, PAGE_SIZE, 0); @@ -289,8 +291,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, /* if updated manually, continuous pages has a gap */ if (bio) submit_bio_out: - __submit_bio(bio, REQ_OP_READ, 0); - + submit_bio(bio); return err ? ERR_PTR(err) : NULL; } @@ -354,7 +355,7 @@ static int erofs_raw_access_readpages(struct file *filp, /* the rare case (end in gaps) */ if (bio) - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); return 0; } diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 40d4dd47bb7a..15545959af92 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -406,6 +406,7 @@ static inline int z_erofs_map_blocks_iter(struct inode *inode, /* data.c */ static inline struct bio *erofs_grab_bio(struct super_block *sb, + unsigned int bi_opf, erofs_blk_t blkaddr, unsigned int nr_pages, void *bi_private, bio_end_io_t endio) @@ -416,16 +417,10 @@ static inline struct bio *erofs_grab_bio(struct super_block *sb, bio_set_dev(bio, sb->s_bdev); bio->bi_iter.bi_sector = (sector_t)blkaddr << LOG_SECTORS_PER_BLOCK; bio->bi_private = bi_private; + bio->bi_opf = bi_opf; return bio; } -static inline void __submit_bio(struct bio *bio, unsigned int op, - unsigned int op_flags) -{ - bio_set_op_attrs(bio, op, op_flags); - submit_bio(bio); -} - struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr); int erofs_map_blocks(struct inode *, struct erofs_map_blocks *, int); diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index abe28565d6c0..ce1a0f2997a9 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1258,12 +1258,12 @@ static bool z_erofs_vle_submit_all(struct super_block *sb, if (bio && force_submit) { submit_bio_retry: - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); bio = NULL; } if (!bio) { - bio = erofs_grab_bio(sb, first_index + i, + bio = erofs_grab_bio(sb, REQ_OP_READ, first_index + i, BIO_MAX_PAGES, bi_private, z_erofs_vle_read_endio); ++nr_bios; @@ -1286,7 +1286,7 @@ static bool z_erofs_vle_submit_all(struct super_block *sb, } while (owned_head != Z_EROFS_PCLUSTER_TAIL); if (bio) - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); if (postsubmit_is_all_bypassed(q, nr_bios, force_fg)) return true; -- 2.17.1 _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B678C3A5A4 for ; Sun, 1 Sep 2019 05:53:40 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AF66F22CF7 for ; Sun, 1 Sep 2019 05:53:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.ozlabs.org header.i=@lists.ozlabs.org header.b="cb4GQRyo"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=aol.com header.i=@aol.com header.b="mXDvfj5D" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF66F22CF7 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=lists.ozlabs.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46Lj7j5yr6zDqsR for ; Sun, 1 Sep 2019 15:53:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.ozlabs.org; s=201707; t=1567317217; bh=V6v19qYF2PCr2q8Mi69ZYXhsnx7ZrAYv/h7bTxG2DcI=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=cb4GQRyoD7V8cgW2YjrEY9vJGshn8pZJX2d24GVwxj0DguJuhGOalpsAjqC6BFphR JQj3cL/muIWXwuKNr5n4Sdeo2cbcgA/71nakcahSYQwKjEIAj3V2wwPzU/vsI9pvSV H8WFHIfkXYE2MmoaGmCTUbul/PeEERaTOdQKI4lITdJFpJVEMw+Rf5cfH5cXTr0Qrr pMQ5q9PBQhQ1kxEkQ4R24wGmhD5voqMWfnMV/jkWcE0TcKUg/WWIT0YfRCF6pyJM/2 CtUwfh9mFouAu++PwccV4WOKybFDQfIhcBif79YZIv7ZVeyzaI7tqoEr5IVSxZ9ljQ ImP9UWgo11ukg== Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=aol.com (client-ip=98.137.69.84; helo=sonic314-21.consmr.mail.gq1.yahoo.com; envelope-from=hsiangkao@aol.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=aol.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=aol.com header.i=@aol.com header.b="mXDvfj5D"; dkim-atps=neutral Received: from sonic314-21.consmr.mail.gq1.yahoo.com (sonic314-21.consmr.mail.gq1.yahoo.com [98.137.69.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46Lj781wcczDqvK for ; Sun, 1 Sep 2019 15:53:07 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1567317185; bh=A0DY0dOyy+x6psHQtnucMUPA/7zTLDXv/4VtOvMsf7M=; h=From:To:Cc:Subject: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b5HWeY5at90QkzSYaOD9oCia3i3k8zCM2GjV5Z2o3vv7mUXA 8tS5vkiYVP77IeCSr13anAR2VidmTX5CyPXYeQvoea7.4s7k95PnuQ_OZ8kl3LdeaNZu_FYxiU5n qLFLV72ACbRMDIOGroehQu16cDjyZhKKtRQZ9Y_7XRkbkJPwsAYob89BQv0LYDFH.YaWQr__eaqP 0UlOOGAs9r98K_TEYadFTf.01c3yWEBeDwHPyY9QfWXBwobSohQVG5li4zc6BUJmuR8pyDThzDSg td8SjfUd5Y0Zk9XTb633gl0WnzIkVBzzz3QbmUzEObGKVI7Cu7TSeji234KmfPSSzY5LWwU0lL.o bfN58UQ2rm7ss8XAB8Ws65eovCKz1DvROqy43IKST.zBrMeKZsg0p4n96Wic_C_1iHu1WbIRU_XZ zoCCud.dzxiVSYtBVuMs8PVgc1qKTHzWEcwrRdO4v3Y2Zw_nD8_JXsssoqaW2ctNPCQoQkDFG7vW Zx23Y22cbGqpkBY0XJNKFK1p9WNDj9xaAXxjhlHWHEVf5hz08iRbNZYBEtD2d2vFCbb2ggW9NGBD e_oAV8CXJGwa_6bFWH_fq9p.bW5Z.3quzw88g2BFgckDqOMnFHA-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.gq1.yahoo.com with HTTP; Sun, 1 Sep 2019 05:53:05 +0000 Received: by smtp406.mail.gq1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 426e3b5ec1af9e36f409445c51071a70; Sun, 01 Sep 2019 05:53:03 +0000 (UTC) To: Christoph Hellwig , Chao Yu , Greg Kroah-Hartman Subject: [PATCH 15/21] erofs: kill __submit_bio() Date: Sun, 1 Sep 2019 13:51:24 +0800 Message-Id: <20190901055130.30572-16-hsiangkao@aol.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190901055130.30572-1-hsiangkao@aol.com> References: <20190802125347.166018-1-gaoxiang25@huawei.com> <20190901055130.30572-1-hsiangkao@aol.com> X-BeenThere: linux-erofs@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development of Linux EROFS file system List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Gao Xiang via Linux-erofs Reply-To: Gao Xiang Cc: linux-fsdevel@vger.kernel.org, devel@driverdev.osuosl.org, linux-erofs@lists.ozlabs.org Errors-To: linux-erofs-bounces+linux-erofs=archiver.kernel.org@lists.ozlabs.org Sender: "Linux-erofs" From: Gao Xiang As Christoph pointed out [1], " Why is there __submit_bio which really just obsfucates what is going on? Also why is __submit_bio using bio_set_op_attrs instead of opencode it as the comment right next to it asks you to? " Let's use submit_bio directly instead. [1] https://lore.kernel.org/lkml/20190830162812.GA10694@infradead.org/ Reported-by: Christoph Hellwig Signed-off-by: Gao Xiang --- fs/erofs/data.c | 15 ++++++++------- fs/erofs/internal.h | 9 ++------- fs/erofs/zdata.c | 6 +++--- 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index 837b07cd2761..d3cd7a453648 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -57,14 +57,15 @@ struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr) if (!PageUptodate(page)) { struct bio *bio; - bio = erofs_grab_bio(sb, blkaddr, 1, sb, read_endio); + bio = erofs_grab_bio(sb, REQ_OP_READ | REQ_META, + blkaddr, 1, sb, read_endio); if (bio_add_page(bio, page, PAGE_SIZE, 0) != PAGE_SIZE) { err = -EFAULT; goto err_out; } - __submit_bio(bio, REQ_OP_READ, REQ_META); + submit_bio(bio); lock_page(page); /* this page has been truncated by others */ @@ -188,7 +189,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, /* not continuous */ *last_block + 1 != current_block) { submit_bio_retry: - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); bio = NULL; } @@ -258,7 +259,8 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, if (nblocks > BIO_MAX_PAGES) nblocks = BIO_MAX_PAGES; - bio = erofs_grab_bio(sb, blknr, nblocks, sb, read_endio); + bio = erofs_grab_bio(sb, REQ_OP_READ, blknr, nblocks, + sb, read_endio); } err = bio_add_page(bio, page, PAGE_SIZE, 0); @@ -289,8 +291,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio, /* if updated manually, continuous pages has a gap */ if (bio) submit_bio_out: - __submit_bio(bio, REQ_OP_READ, 0); - + submit_bio(bio); return err ? ERR_PTR(err) : NULL; } @@ -354,7 +355,7 @@ static int erofs_raw_access_readpages(struct file *filp, /* the rare case (end in gaps) */ if (bio) - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); return 0; } diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 40d4dd47bb7a..15545959af92 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -406,6 +406,7 @@ static inline int z_erofs_map_blocks_iter(struct inode *inode, /* data.c */ static inline struct bio *erofs_grab_bio(struct super_block *sb, + unsigned int bi_opf, erofs_blk_t blkaddr, unsigned int nr_pages, void *bi_private, bio_end_io_t endio) @@ -416,16 +417,10 @@ static inline struct bio *erofs_grab_bio(struct super_block *sb, bio_set_dev(bio, sb->s_bdev); bio->bi_iter.bi_sector = (sector_t)blkaddr << LOG_SECTORS_PER_BLOCK; bio->bi_private = bi_private; + bio->bi_opf = bi_opf; return bio; } -static inline void __submit_bio(struct bio *bio, unsigned int op, - unsigned int op_flags) -{ - bio_set_op_attrs(bio, op, op_flags); - submit_bio(bio); -} - struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr); int erofs_map_blocks(struct inode *, struct erofs_map_blocks *, int); diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index abe28565d6c0..ce1a0f2997a9 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1258,12 +1258,12 @@ static bool z_erofs_vle_submit_all(struct super_block *sb, if (bio && force_submit) { submit_bio_retry: - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); bio = NULL; } if (!bio) { - bio = erofs_grab_bio(sb, first_index + i, + bio = erofs_grab_bio(sb, REQ_OP_READ, first_index + i, BIO_MAX_PAGES, bi_private, z_erofs_vle_read_endio); ++nr_bios; @@ -1286,7 +1286,7 @@ static bool z_erofs_vle_submit_all(struct super_block *sb, } while (owned_head != Z_EROFS_PCLUSTER_TAIL); if (bio) - __submit_bio(bio, REQ_OP_READ, 0); + submit_bio(bio); if (postsubmit_is_all_bypassed(q, nr_bios, force_fg)) return true; -- 2.17.1