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 Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62BF1C636D3 for ; Tue, 31 Jan 2023 02:45:06 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pMgdt-0007wl-BG; Tue, 31 Jan 2023 02:45:03 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pMgds-0007wf-5c for linux-f2fs-devel@lists.sourceforge.net; Tue, 31 Jan 2023 02:45:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ivpfDZ5zsENtlw4/fz6s/y3qfl9k2JCqpKXN/aelaSs=; b=VS6JRbRqpAHDVNiG4GB0TO/NZO Rjk4XGfoqGoDpQ0s0IhHRkElfS17uEh+gDq5TdGGukyLmErJJFMtGirX6a3Qiw8ipA/yXvPK/VF2c JHFQjpaJnDynCaF4lmKCqyyZsq9jfYgoKUSWj9qGB6+WL0C/KmQv95Fvh5eAc1yBJdZM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=ivpfDZ5zsENtlw4/fz6s/y3qfl9k2JCqpKXN/aelaSs=; b=d 60gE9GL9imuLkXmilwNrhbnWbN7aZfUP/fWAchhF7dtuBwIDX7wb1kffPLMwcGINgh4qUd208bi47 pMiNE9HVB1YAGxXIt+R1w93qSHWIF3lqvjlp17HwfLhLqGSTvkDHGCyHVZD3H/79WZuVFeh7hBe+4 KhVqscnCpepYvjcM=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pMgdo-0007Jh-2K for linux-f2fs-devel@lists.sourceforge.net; Tue, 31 Jan 2023 02:45:02 +0000 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 A1EC661231 for ; Tue, 31 Jan 2023 02:44:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC720C433EF; Tue, 31 Jan 2023 02:44:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675133094; bh=QVFjJoLFmdtkQW9NmgxPlTz8Uuo3RJOYGK+UZbncgoA=; h=From:To:Cc:Subject:Date:From; b=quOLHE1Y+ks7/vYDxb7hs9Zj8dE5XPFvuo/BRqJ87MxTDGiv0nbotwot9o+p5upDY XscFJCwFwNRe6AZfd7qequBekTTiL/B+a1uHW0yh8GHyCUJvgubjqjofZrmAS+NMYT 5y8XVJkTJeX9jLSgFOiP4euJl+6wc8iXmsQiGyo45tooBZuL9PnFSDAzY8eoUj8f5J u2+iWtTct+JsyyMuCf36dKkorzyyhrImEBfZvVheGlYEtlXKN1nN0kKjkMkJcrUYuo Lhh7cgINqe2nsrwgpv1+99aG4qvSL2HCkiZv93WirZLupeOq/fMXRd4h2GmdmJvquF RHnHUwxycA65g== From: Chao Yu To: jaegeuk@kernel.org Date: Tue, 31 Jan 2023 10:44:44 +0800 Message-Id: <20230131024444.2598081-1-chao@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Headers-End: 1pMgdo-0007Jh-2K Subject: [f2fs-dev] [PATCH] f2fs: clean up parameters of iostat_update_and_unbind_ctx() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Parsing sync/rw type from bio inside iostat_update_and_unbind_ctx() to avoid unnecessary parameters. Signed-off-by: Chao Yu --- - this patch is based on [PATCH v3] f2fs: use iostat_lat_type directly as a parameter in the iostat_update_and_unbind_ctx() fs/f2fs/data.c | 4 ++-- fs/f2fs/iostat.c | 14 ++++++++++---- fs/f2fs/iostat.h | 4 ++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 89299efae812..fa83f1774048 100644 --- a/fs/f2fs/data.c +++ b/fs/f2fs/data.c @@ -292,7 +292,7 @@ static void f2fs_read_end_io(struct bio *bio) struct bio_post_read_ctx *ctx; bool intask = in_task(); - iostat_update_and_unbind_ctx(bio, READ_IO); + iostat_update_and_unbind_ctx(bio); ctx = bio->bi_private; if (time_to_inject(sbi, FAULT_READ_IO)) @@ -330,7 +330,7 @@ static void f2fs_write_end_io(struct bio *bio) struct bio_vec *bvec; struct bvec_iter_all iter_all; - iostat_update_and_unbind_ctx(bio, bio->bi_opf & REQ_SYNC ? WRITE_SYNC_IO : WRITE_ASYNC_IO); + iostat_update_and_unbind_ctx(bio); sbi = bio->bi_private; if (time_to_inject(sbi, FAULT_WRITE_IO)) diff --git a/fs/f2fs/iostat.c b/fs/f2fs/iostat.c index c767a2e7d5a9..14c8f1ec8c12 100644 --- a/fs/f2fs/iostat.c +++ b/fs/f2fs/iostat.c @@ -241,14 +241,20 @@ static inline void __update_iostat_latency(struct bio_iostat_ctx *iostat_ctx, spin_unlock_irqrestore(&sbi->iostat_lat_lock, flags); } -void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type lat_type) +void iostat_update_and_unbind_ctx(struct bio *bio) { struct bio_iostat_ctx *iostat_ctx = bio->bi_private; + enum iostat_lat_type lat_type; - if (lat_type == READ_IO) - bio->bi_private = iostat_ctx->post_read_ctx; - else + if (op_is_write(bio_op(bio))) { + lat_type = bio->bi_opf & REQ_SYNC ? + WRITE_SYNC_IO : WRITE_ASYNC_IO; bio->bi_private = iostat_ctx->sbi; + } else { + lat_type = READ_IO; + bio->bi_private = iostat_ctx->post_read_ctx; + } + __update_iostat_latency(iostat_ctx, lat_type); mempool_free(iostat_ctx, bio_iostat_ctx_pool); } diff --git a/fs/f2fs/iostat.h b/fs/f2fs/iostat.h index 1f827a2fe6b2..eb99d05cf272 100644 --- a/fs/f2fs/iostat.h +++ b/fs/f2fs/iostat.h @@ -58,7 +58,7 @@ static inline struct bio_post_read_ctx *get_post_read_ctx(struct bio *bio) return iostat_ctx->post_read_ctx; } -extern void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type type); +extern void iostat_update_and_unbind_ctx(struct bio *bio); extern void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi, struct bio *bio, struct bio_post_read_ctx *ctx); extern int f2fs_init_iostat_processing(void); @@ -68,7 +68,7 @@ extern void f2fs_destroy_iostat(struct f2fs_sb_info *sbi); #else static inline void f2fs_update_iostat(struct f2fs_sb_info *sbi, struct inode *inode, enum iostat_type type, unsigned long long io_bytes) {} -static inline void iostat_update_and_unbind_ctx(struct bio *bio, enum iostat_lat_type type) {} +static inline void iostat_update_and_unbind_ctx(struct bio *bio) {} static inline void iostat_alloc_and_bind_ctx(struct f2fs_sb_info *sbi, struct bio *bio, struct bio_post_read_ctx *ctx) {} static inline void iostat_update_submit_ctx(struct bio *bio, -- 2.25.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel