From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 3/3] f2fs: clean up data_blkaddr() and get_dnode_addr()
Date: Wed, 10 Jul 2024 23:20:32 +0000 [thread overview]
Message-ID: <Zo8XQAACHaGrwYVN@google.com> (raw)
In-Reply-To: <20240625031604.3587691-3-chao@kernel.org>
On 06/25, Chao Yu wrote:
> Introudce a new help get_dnode_base() to wrap common code from
> get_dnode_addr() and data_blkaddr() for cleanup.
>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
> fs/f2fs/f2fs.h | 46 +++++++++++++++++++---------------------------
> 1 file changed, 19 insertions(+), 27 deletions(-)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 1f78a39fe7f4..eacf0b0e6b2e 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -2905,26 +2905,31 @@ static inline __le32 *blkaddr_in_node(struct f2fs_node *node)
> }
>
> static inline int f2fs_has_extra_attr(struct inode *inode);
> -static inline block_t data_blkaddr(struct inode *inode,
> - struct page *node_page, unsigned int offset)
> +static inline int get_extra_isize(struct inode *inode);
It seems get_extra_isize was already declared above?
> +static inline unsigned int get_dnode_base(struct inode *inode,
> + struct page *node_page)
> {
> - struct f2fs_node *raw_node;
> - __le32 *addr_array;
> - int base = 0;
> - bool is_inode = IS_INODE(node_page);
> -
> - raw_node = F2FS_NODE(node_page);
> -
> - if (is_inode) {
> + if (IS_INODE(node_page)) {
> if (!inode)
> /* from GC path only */
> - base = offset_in_addr(&raw_node->i);
> + return offset_in_addr(&F2FS_NODE(node_page)->i);
> else if (f2fs_has_extra_attr(inode))
> - base = get_extra_isize(inode);
> + return get_extra_isize(inode);
if (!IS_INODE(node_page))
return 0;
return inode ? get_extra_isize(inode) :
offset_in_addr();
> }
> + return 0;
> +}
>
> - addr_array = blkaddr_in_node(raw_node);
> - return le32_to_cpu(addr_array[base + offset]);
> +static inline __le32 *get_dnode_addr(struct inode *inode,
> + struct page *node_page)
> +{
> + return blkaddr_in_node(F2FS_NODE(node_page)) +
> + get_dnode_base(inode, node_page);
> +}
> +
> +static inline block_t data_blkaddr(struct inode *inode,
> + struct page *node_page, unsigned int offset)
> +{
> + return le32_to_cpu(*(get_dnode_addr(inode, node_page) + offset));
> }
>
> static inline block_t f2fs_data_blkaddr(struct dnode_of_data *dn)
> @@ -3297,8 +3302,6 @@ static inline bool f2fs_is_cow_file(struct inode *inode)
> return is_inode_flag_set(inode, FI_COW_FILE);
> }
>
> -static inline __le32 *get_dnode_addr(struct inode *inode,
> - struct page *node_page);
> static inline void *inline_data_addr(struct inode *inode, struct page *page)
> {
> __le32 *addr = get_dnode_addr(inode, page);
> @@ -3437,17 +3440,6 @@ static inline int get_inline_xattr_addrs(struct inode *inode)
> return F2FS_I(inode)->i_inline_xattr_size;
> }
>
> -static inline __le32 *get_dnode_addr(struct inode *inode,
> - struct page *node_page)
> -{
> - int base = 0;
> -
> - if (IS_INODE(node_page) && f2fs_has_extra_attr(inode))
> - base = get_extra_isize(inode);
> -
> - return blkaddr_in_node(F2FS_NODE(node_page)) + base;
> -}
> -
> #define f2fs_get_inode_mode(i) \
> ((is_inode_flag_set(i, FI_ACL_MODE)) ? \
> (F2FS_I(i)->i_acl_mode) : ((i)->i_mode))
> --
> 2.40.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] f2fs: clean up data_blkaddr() and get_dnode_addr()
Date: Wed, 10 Jul 2024 23:20:32 +0000 [thread overview]
Message-ID: <Zo8XQAACHaGrwYVN@google.com> (raw)
In-Reply-To: <20240625031604.3587691-3-chao@kernel.org>
On 06/25, Chao Yu wrote:
> Introudce a new help get_dnode_base() to wrap common code from
> get_dnode_addr() and data_blkaddr() for cleanup.
>
> Signed-off-by: Chao Yu <chao@kernel.org>
> ---
> fs/f2fs/f2fs.h | 46 +++++++++++++++++++---------------------------
> 1 file changed, 19 insertions(+), 27 deletions(-)
>
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index 1f78a39fe7f4..eacf0b0e6b2e 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -2905,26 +2905,31 @@ static inline __le32 *blkaddr_in_node(struct f2fs_node *node)
> }
>
> static inline int f2fs_has_extra_attr(struct inode *inode);
> -static inline block_t data_blkaddr(struct inode *inode,
> - struct page *node_page, unsigned int offset)
> +static inline int get_extra_isize(struct inode *inode);
It seems get_extra_isize was already declared above?
> +static inline unsigned int get_dnode_base(struct inode *inode,
> + struct page *node_page)
> {
> - struct f2fs_node *raw_node;
> - __le32 *addr_array;
> - int base = 0;
> - bool is_inode = IS_INODE(node_page);
> -
> - raw_node = F2FS_NODE(node_page);
> -
> - if (is_inode) {
> + if (IS_INODE(node_page)) {
> if (!inode)
> /* from GC path only */
> - base = offset_in_addr(&raw_node->i);
> + return offset_in_addr(&F2FS_NODE(node_page)->i);
> else if (f2fs_has_extra_attr(inode))
> - base = get_extra_isize(inode);
> + return get_extra_isize(inode);
if (!IS_INODE(node_page))
return 0;
return inode ? get_extra_isize(inode) :
offset_in_addr();
> }
> + return 0;
> +}
>
> - addr_array = blkaddr_in_node(raw_node);
> - return le32_to_cpu(addr_array[base + offset]);
> +static inline __le32 *get_dnode_addr(struct inode *inode,
> + struct page *node_page)
> +{
> + return blkaddr_in_node(F2FS_NODE(node_page)) +
> + get_dnode_base(inode, node_page);
> +}
> +
> +static inline block_t data_blkaddr(struct inode *inode,
> + struct page *node_page, unsigned int offset)
> +{
> + return le32_to_cpu(*(get_dnode_addr(inode, node_page) + offset));
> }
>
> static inline block_t f2fs_data_blkaddr(struct dnode_of_data *dn)
> @@ -3297,8 +3302,6 @@ static inline bool f2fs_is_cow_file(struct inode *inode)
> return is_inode_flag_set(inode, FI_COW_FILE);
> }
>
> -static inline __le32 *get_dnode_addr(struct inode *inode,
> - struct page *node_page);
> static inline void *inline_data_addr(struct inode *inode, struct page *page)
> {
> __le32 *addr = get_dnode_addr(inode, page);
> @@ -3437,17 +3440,6 @@ static inline int get_inline_xattr_addrs(struct inode *inode)
> return F2FS_I(inode)->i_inline_xattr_size;
> }
>
> -static inline __le32 *get_dnode_addr(struct inode *inode,
> - struct page *node_page)
> -{
> - int base = 0;
> -
> - if (IS_INODE(node_page) && f2fs_has_extra_attr(inode))
> - base = get_extra_isize(inode);
> -
> - return blkaddr_in_node(F2FS_NODE(node_page)) + base;
> -}
> -
> #define f2fs_get_inode_mode(i) \
> ((is_inode_flag_set(i, FI_ACL_MODE)) ? \
> (F2FS_I(i)->i_acl_mode) : ((i)->i_mode))
> --
> 2.40.1
next prev parent reply other threads:[~2024-07-10 23:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-25 3:16 [f2fs-dev] [PATCH 1/3] f2fs: clean up F2FS_I() Chao Yu
2024-06-25 3:16 ` Chao Yu
2024-06-25 3:16 ` [f2fs-dev] [PATCH 2/3] f2fs: clean up addrs_per_{inode,block}() Chao Yu
2024-06-25 3:16 ` Chao Yu
2024-06-25 3:16 ` [f2fs-dev] [PATCH 3/3] f2fs: clean up data_blkaddr() and get_dnode_addr() Chao Yu
2024-06-25 3:16 ` Chao Yu
2024-07-10 23:20 ` Jaegeuk Kim [this message]
2024-07-10 23:20 ` Jaegeuk Kim
2024-07-15 14:40 ` [f2fs-dev] [PATCH 1/3] f2fs: clean up F2FS_I() patchwork-bot+f2fs
2024-07-15 14:40 ` patchwork-bot+f2fs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zo8XQAACHaGrwYVN@google.com \
--to=jaegeuk@kernel.org \
--cc=chao@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.