From patchwork Fri Feb 3 03:53:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingbo Xu X-Patchwork-Id: 52294 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp627280wrn; Thu, 2 Feb 2023 19:56:57 -0800 (PST) X-Google-Smtp-Source: AK7set+KEekcJwnRBwjkm2K0m4d/5ngBf0OyQ9Nar82gEgioVElyf5AueessNWh4MhvkRrWaJ0FM X-Received: by 2002:a17:906:4b09:b0:883:4ce3:99c2 with SMTP id y9-20020a1709064b0900b008834ce399c2mr8122906eju.34.1675396617321; Thu, 02 Feb 2023 19:56:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675396617; cv=none; d=google.com; s=arc-20160816; b=BB+tkoS2FtyAqnkjYlsP2ZQS3eb9ofpsV25u6mOfdF6pNI4kPuhIp6HNi8BvpwAQAG iYbYGiVyOSJd/X3mdkYWM4/8YalcnN8p5d0kmtCrUkFMM5UXuIww+IKUhSr9OUG0k/sL XqUei7jHJZfRkkaQYd4Lk3/dD09/nv4jp8BmI2RY63RkwgzLlAU7ElL7Yc7swsQF/2I6 Nmnr+HnckGrBxSJQZOXhmuSE1BrWaiKXJ24mfPVlBVtiKTZ+izjjPkyULD+QKblYHhkQ cSzCIgzW/GnfbCA8vlEpRzU0BPA4PiswmEoubRAuwnMmt8UdlyfO0MjujzFl7eciXQ8h JLyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rpzZk2Dmcpbc0fI6oLl6XtBoeP15HTo1lw33OaWZvDo=; b=OZM8sXPvW7UKUF8UNiCWhHZhPLdnFzr96miTySQjPIdQQKxO+fwQxRUS95ZJnsF0DN fjJ0gU5pRGWH/9pzIu4Dc0SQdii3C4ezFywSjCTlQG6TrQ2GtNqwxpN4obVPfFI0kEDh tDmx24y3pAZvkYagg8JywvVay62/4Feoj+XV2YUElMnlyw9loBSYM0tILyCv6jwZqXYZ UVpd9lC16Gev09NrFicsjnBnnc7Ngc3oU2fpniVPbsu64jOiqgO1CqJj/eXsfJBOyybQ wRQMJRR8RfwV6HMTexquBjNLESvjUNxnKtQSEumMs38GV43TFqrHvm6aOrUtYKiot7FS EwuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id up25-20020a170907cc9900b008787e4ac0bfsi1445066ejc.719.2023.02.02.19.56.34; Thu, 02 Feb 2023 19:56:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232007AbjBCDxM (ORCPT + 99 others); Thu, 2 Feb 2023 22:53:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231761AbjBCDxH (ORCPT ); Thu, 2 Feb 2023 22:53:07 -0500 Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4B722366C for ; Thu, 2 Feb 2023 19:53:06 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R521e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0Van-IJ7_1675396384; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0Van-IJ7_1675396384) by smtp.aliyun-inc.com; Fri, 03 Feb 2023 11:53:04 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org, huyue2@coolpad.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/3] erofs: add print symbols for various flags in trace Date: Fri, 3 Feb 2023 11:53:01 +0800 Message-Id: <20230203035303.35082-2-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230203035303.35082-1-jefflexu@linux.alibaba.com> References: <20230203035303.35082-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756780683546767200?= X-GMAIL-MSGID: =?utf-8?q?1756780683546767200?= As new flags introduced, the corresponding print symbols for trace are not added accordingly. Add these missing print symbols for these flags. Signed-off-by: Jingbo Xu --- include/trace/events/erofs.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/trace/events/erofs.h b/include/trace/events/erofs.h index 4f4c44ea3a65..c0dbe9c4f656 100644 --- a/include/trace/events/erofs.h +++ b/include/trace/events/erofs.h @@ -19,12 +19,18 @@ struct erofs_map_blocks; { 1, "DIR" }) #define show_map_flags(flags) __print_flags(flags, "|", \ - { EROFS_GET_BLOCKS_RAW, "RAW" }) + { EROFS_GET_BLOCKS_RAW, "RAW" }, \ + { EROFS_GET_BLOCKS_FIEMAP, "FIEMAP" }, \ + { EROFS_GET_BLOCKS_READMORE, "READMORE" }, \ + { EROFS_GET_BLOCKS_FINDTAIL, "FINDTAIL" }) #define show_mflags(flags) __print_flags(flags, "", \ - { EROFS_MAP_MAPPED, "M" }, \ - { EROFS_MAP_META, "I" }, \ - { EROFS_MAP_ENCODED, "E" }) + { EROFS_MAP_MAPPED, "M" }, \ + { EROFS_MAP_META, "I" }, \ + { EROFS_MAP_ENCODED, "E" }, \ + { EROFS_MAP_FULL_MAPPED, "F" }, \ + { EROFS_MAP_FRAGMENT, "R" }, \ + { EROFS_MAP_PARTIAL_REF, "P" }) TRACE_EVENT(erofs_lookup, From patchwork Fri Feb 3 03:53:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingbo Xu X-Patchwork-Id: 52292 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp627204wrn; Thu, 2 Feb 2023 19:56:38 -0800 (PST) X-Google-Smtp-Source: AK7set+KH0x+LEyUeu6NFw6eh0ahA7yi83BgszGxtIKZMkLJq51PSTzue87mmB6XgFdEDFXZBqoT X-Received: by 2002:aa7:db88:0:b0:472:1436:73ab with SMTP id u8-20020aa7db88000000b00472143673abmr7778505edt.28.1675396598436; Thu, 02 Feb 2023 19:56:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675396598; cv=none; d=google.com; s=arc-20160816; b=YApUjpfv+pBfsEtM+22agDypK+YBrZ+EJ9RsG/0oQIAKZYNL9Twlyi6iID0ciYuBSk RSFIv4SEeiicGkEtcXCmEcuIbBYWWHTK2N/vxGTqnLgrP9YSrjZ0m6h/U9cSw3RL80cZ 6I+7WJcrFz2Op1NphmdKoY5odhDcRPZFjMO0LJmSpXompHWZsixo8iJ8WJ2LVvuMa66D PMQXZOcUxugzd5jeoQ7znp1/reUP+6yWaPuwP10HV2UnpjxSqu5tzPOAmWx2POyMvHO0 8Je1e9+Wt2ZyBIe2fCj6dLG1V4NGjhtwEbfb00Rtr88RO2GYxtSTETe2/22dNBW7ans5 DFnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xJv7SEHWOnn72y3cKlNOv1+U3YGdGgTo73r+FFtY25Y=; b=kpz7S+UFZM7VcLyfVSrg0rCOxU525BP5iH9FePW99HYiVAOlKXVX2BBzvkk0IFskPT L2SO5rDt2jgMzb9bbRhINwiVFLI/hmau618o6fJAm7emC1Ouao6YeJWYy1XHaGTrAmhN VJMkc2QO2LCFN8PDupd6W95FfZT+WflWYSUolu4iwnMPusVUMLWM33cmWivMd4vHTNAx 5z6qQZn5VJed+uEj23jgLFJgq63s9YeZjJt+E82pTosQ0uTL3OMIA4JpyRKAjm3oK6gi 2v65lE7bissyqaphEZDc6Z9bGCmhc0cc4f/B2K7lbqhP1aj4PDGzwBrV2Ey1X9ni++0s zZmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p26-20020a056402501a00b004a213b19ba2si1636603eda.1.2023.02.02.19.56.14; Thu, 02 Feb 2023 19:56:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232157AbjBCDxP (ORCPT + 99 others); Thu, 2 Feb 2023 22:53:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231916AbjBCDxJ (ORCPT ); Thu, 2 Feb 2023 22:53:09 -0500 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBF1A298C3 for ; Thu, 2 Feb 2023 19:53:07 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R161e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0VanENqc_1675396384; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VanENqc_1675396384) by smtp.aliyun-inc.com; Fri, 03 Feb 2023 11:53:05 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org, huyue2@coolpad.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH 2/3] erofs: remove unused flags parameter of erofs_map_blocks() Date: Fri, 3 Feb 2023 11:53:02 +0800 Message-Id: <20230203035303.35082-3-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230203035303.35082-1-jefflexu@linux.alibaba.com> References: <20230203035303.35082-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756780663521365266?= X-GMAIL-MSGID: =?utf-8?q?1756780663521365266?= For erofs_map_blocks() and erofs_map_blocks_flatmode(), the flags argument is always EROFS_GET_BLOCKS_RAW, as the compression routine implements its own map_blocks() variant. Signed-off-by: Jingbo Xu --- fs/erofs/data.c | 14 ++++++-------- fs/erofs/fscache.c | 4 ++-- fs/erofs/internal.h | 5 ++--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index f57f921683d7..32e66d29968f 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -74,8 +74,7 @@ void *erofs_read_metabuf(struct erofs_buf *buf, struct super_block *sb, } static int erofs_map_blocks_flatmode(struct inode *inode, - struct erofs_map_blocks *map, - int flags) + struct erofs_map_blocks *map) { erofs_blk_t nblocks, lastblk; u64 offset = map->m_la; @@ -117,8 +116,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode, return 0; } -int erofs_map_blocks(struct inode *inode, - struct erofs_map_blocks *map, int flags) +int erofs_map_blocks(struct inode *inode, struct erofs_map_blocks *map) { struct super_block *sb = inode->i_sb; struct erofs_inode *vi = EROFS_I(inode); @@ -130,7 +128,7 @@ int erofs_map_blocks(struct inode *inode, void *kaddr; int err = 0; - trace_erofs_map_blocks_enter(inode, map, flags); + trace_erofs_map_blocks_enter(inode, map, EROFS_GET_BLOCKS_RAW); map->m_deviceid = 0; if (map->m_la >= inode->i_size) { /* leave out-of-bound access unmapped */ @@ -140,7 +138,7 @@ int erofs_map_blocks(struct inode *inode, } if (vi->datalayout != EROFS_INODE_CHUNK_BASED) { - err = erofs_map_blocks_flatmode(inode, map, flags); + err = erofs_map_blocks_flatmode(inode, map); goto out; } @@ -192,7 +190,7 @@ int erofs_map_blocks(struct inode *inode, out: if (!err) map->m_llen = map->m_plen; - trace_erofs_map_blocks_exit(inode, map, flags, 0); + trace_erofs_map_blocks_exit(inode, map, EROFS_GET_BLOCKS_RAW, err); return err; } @@ -255,7 +253,7 @@ static int erofs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, map.m_la = offset; map.m_llen = length; - ret = erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW); + ret = erofs_map_blocks(inode, &map); if (ret < 0) return ret; diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index d47b04dfdc48..7f1ef2ffc4db 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -229,7 +229,7 @@ static int erofs_fscache_data_read_slice(struct erofs_fscache_request *primary) int ret; map.m_la = pos; - ret = erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW); + ret = erofs_map_blocks(inode, &map); if (ret) return ret; @@ -377,7 +377,7 @@ static int erofs_fscache_share_file_open(struct inode *inode, struct file *filp) struct file *realfile; int ret; - ret = erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW); + ret = erofs_map_blocks(inode, &map); if (ret) return ret; diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index a63a9e951fe0..323c2c775023 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -445,7 +445,7 @@ struct erofs_map_blocks { unsigned int m_flags; }; -/* Flags used by erofs_map_blocks_flatmode() */ +/* Used to map raw data */ #define EROFS_GET_BLOCKS_RAW 0x0001 /* * Used to get the exact decompressed length, e.g. fiemap (consider lookback @@ -502,8 +502,7 @@ void *erofs_read_metabuf(struct erofs_buf *buf, struct super_block *sb, int erofs_map_dev(struct super_block *sb, struct erofs_map_dev *dev); int erofs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, u64 start, u64 len); -int erofs_map_blocks(struct inode *inode, - struct erofs_map_blocks *map, int flags); +int erofs_map_blocks(struct inode *inode, struct erofs_map_blocks *map); /* inode.c */ static inline unsigned long erofs_inode_hash(erofs_nid_t nid) From patchwork Fri Feb 3 03:53:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingbo Xu X-Patchwork-Id: 52293 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp627210wrn; Thu, 2 Feb 2023 19:56:40 -0800 (PST) X-Google-Smtp-Source: AK7set/G+h3spU1nqHMxVA33sloIFf2mIzcN+5d05mC+Dp5ckNeW9gfU3V/53kcWDhbMvBFPwJqM X-Received: by 2002:a17:906:edc4:b0:885:5231:359c with SMTP id sb4-20020a170906edc400b008855231359cmr7798706ejb.5.1675396600300; Thu, 02 Feb 2023 19:56:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675396600; cv=none; d=google.com; s=arc-20160816; b=i6lcOiWnlogJeoCxDEMsr5rLyk56UIfVq1X9eYyCY5cjZPn/DDEAjkyp+f82rpkn9n nHe17rL//nmawFZ4uHJYNZHSMjnJbbsd6brtS7gfWtZHD2IlDYeUU/dOJmArEvRn9az1 CMWhhDT84C0dLtcrlDYN+48oozFoC38OMBTvk4HdV2O9xFz4XPWkSHo6kjpz8Ap6Kkw1 of+K7JMVsZYodrdD48PJQgnROoq4/KU5bmPr3ai3SrLfORZytxLerFwF/2W+BuuXEKjS un1ohjJoBtOKeN6ML5pIRFMaVExQbW7zr/dVQzQx2EJKwSEfLgMEo7VBEcG+yswZFJZO Loew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xEmekXbMpCoNf3rwaAJhUEEzoqQPTif3zohupUe5Nmc=; b=leEw/IsljM/pVZppNdLS5AXAA+CgP+9QYsRWTYDE16x1B4SKjbyw3qgV5x4ZxmK74W BbWOBFj9DLl7qzqrCheTYf+Kigq9QLFnTMzzPf8i2ag2oLq0NVrbrcVlbx7DNqzcJDYs sKegygPKMcnqBB2lG4IxDVyFlswk0tbIBXyzx6XGGYhnajFUEqZQfHaEuAsLIdGroae6 uHeuIGWf3RzDNfYAFN2P8zDygD6NDs4ojZ9GMmZjlI486HwlpuZksZwZTFpnGfr7iKru Ry1S+amFJjw18WqYt5irKtj8tCo+xa9d9Y4PaDbIY/8MWtAbjCXJt7PMJE0lPBy6G0DQ AbEg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id eb8-20020a0564020d0800b0049e1782c0e8si1784737edb.491.2023.02.02.19.56.15; Thu, 02 Feb 2023 19:56:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232241AbjBCDxT (ORCPT + 99 others); Thu, 2 Feb 2023 22:53:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231866AbjBCDxK (ORCPT ); Thu, 2 Feb 2023 22:53:10 -0500 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0148233CA for ; Thu, 2 Feb 2023 19:53:08 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=5;SR=0;TI=SMTPD_---0Van4Hcy_1675396385; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0Van4Hcy_1675396385) by smtp.aliyun-inc.com; Fri, 03 Feb 2023 11:53:06 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org, huyue2@coolpad.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH 3/3] erofs: call erofs_map_dev() inside erofs_map_blocks() Date: Fri, 3 Feb 2023 11:53:03 +0800 Message-Id: <20230203035303.35082-4-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20230203035303.35082-1-jefflexu@linux.alibaba.com> References: <20230203035303.35082-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756780665162797844?= X-GMAIL-MSGID: =?utf-8?q?1756780665162797844?= For now erofs_map_blocks() is always followed by erofs_map_dev(). Make erofs_map_dev() called inside erofs_map_blocks() to reduce code duplication. Signed-off-by: Jingbo Xu --- fs/erofs/data.c | 21 ++++++++++----------- fs/erofs/fscache.c | 20 ++------------------ fs/erofs/internal.h | 3 ++- 3 files changed, 14 insertions(+), 30 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index 32e66d29968f..cbe7a6d6846d 100644 --- a/fs/erofs/data.c +++ b/fs/erofs/data.c @@ -116,7 +116,8 @@ static int erofs_map_blocks_flatmode(struct inode *inode, return 0; } -int erofs_map_blocks(struct inode *inode, struct erofs_map_blocks *map) +int erofs_map_blocks(struct inode *inode, struct erofs_map_blocks *map, + struct erofs_map_dev *mdev) { struct super_block *sb = inode->i_sb; struct erofs_inode *vi = EROFS_I(inode); @@ -188,8 +189,14 @@ int erofs_map_blocks(struct inode *inode, struct erofs_map_blocks *map) out_unlock: erofs_put_metabuf(&buf); out: - if (!err) + if (!err) { map->m_llen = map->m_plen; + *mdev = (struct erofs_map_dev) { + .m_deviceid = map->m_deviceid, + .m_pa = map->m_pa, + }; + err = erofs_map_dev(sb, mdev); + } trace_erofs_map_blocks_exit(inode, map, EROFS_GET_BLOCKS_RAW, err); return err; } @@ -253,15 +260,7 @@ static int erofs_iomap_begin(struct inode *inode, loff_t offset, loff_t length, map.m_la = offset; map.m_llen = length; - ret = erofs_map_blocks(inode, &map); - if (ret < 0) - return ret; - - mdev = (struct erofs_map_dev) { - .m_deviceid = map.m_deviceid, - .m_pa = map.m_pa, - }; - ret = erofs_map_dev(inode->i_sb, &mdev); + ret = erofs_map_blocks(inode, &map, &mdev); if (ret) return ret; diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index 7f1ef2ffc4db..140ccacc1043 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -229,7 +229,7 @@ static int erofs_fscache_data_read_slice(struct erofs_fscache_request *primary) int ret; map.m_la = pos; - ret = erofs_map_blocks(inode, &map); + ret = erofs_map_blocks(inode, &map, &mdev); if (ret) return ret; @@ -270,14 +270,6 @@ static int erofs_fscache_data_read_slice(struct erofs_fscache_request *primary) count = min_t(size_t, map.m_llen - (pos - map.m_la), count); DBG_BUGON(!count || count % PAGE_SIZE); - mdev = (struct erofs_map_dev) { - .m_deviceid = map.m_deviceid, - .m_pa = map.m_pa, - }; - ret = erofs_map_dev(sb, &mdev); - if (ret) - return ret; - req = erofs_fscache_req_chain(primary, count); if (IS_ERR(req)) return PTR_ERR(req); @@ -377,15 +369,7 @@ static int erofs_fscache_share_file_open(struct inode *inode, struct file *filp) struct file *realfile; int ret; - ret = erofs_map_blocks(inode, &map); - if (ret) - return ret; - - mdev = (struct erofs_map_dev) { - .m_deviceid = map.m_deviceid, - .m_pa = map.m_pa, - }; - ret = erofs_map_dev(inode->i_sb, &mdev); + ret = erofs_map_blocks(inode, &map, &mdev); if (ret) return ret; diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 323c2c775023..c54dec32a868 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -502,7 +502,8 @@ void *erofs_read_metabuf(struct erofs_buf *buf, struct super_block *sb, int erofs_map_dev(struct super_block *sb, struct erofs_map_dev *dev); int erofs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, u64 start, u64 len); -int erofs_map_blocks(struct inode *inode, struct erofs_map_blocks *map); +int erofs_map_blocks(struct inode *inode, struct erofs_map_blocks *map, + struct erofs_map_dev *mdev); /* inode.c */ static inline unsigned long erofs_inode_hash(erofs_nid_t nid)