f2fs: clean up parameter of macro XATTR_SIZE()
authorChao Yu <yuchao0@huawei.com>
Fri, 14 Feb 2020 09:44:11 +0000 (17:44 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Thu, 19 Mar 2020 18:41:25 +0000 (11:41 -0700)
Just cleanup, no logic change.

Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/xattr.c
fs/f2fs/xattr.h

index 6794a13064be38c42317c889301b443ab1911c23..d4800df6302d3295a22895ade8848c96210a6470 100644 (file)
@@ -312,12 +312,12 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage,
        if (!xnid && !inline_size)
                return -ENODATA;
 
-       *base_size = XATTR_SIZE(xnid, inode) + XATTR_PADDING_SIZE;
+       *base_size = XATTR_SIZE(inode) + XATTR_PADDING_SIZE;
        txattr_addr = f2fs_kzalloc(F2FS_I_SB(inode), *base_size, GFP_NOFS);
        if (!txattr_addr)
                return -ENOMEM;
 
-       last_txattr_addr = (void *)txattr_addr + XATTR_SIZE(xnid, inode);
+       last_txattr_addr = (void *)txattr_addr + XATTR_SIZE(inode);
 
        /* read from inline xattr */
        if (inline_size) {
@@ -539,7 +539,6 @@ out:
 ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
 {
        struct inode *inode = d_inode(dentry);
-       nid_t xnid = F2FS_I(inode)->i_xattr_nid;
        struct f2fs_xattr_entry *entry;
        void *base_addr, *last_base_addr;
        int error = 0;
@@ -551,7 +550,7 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size)
        if (error)
                return error;
 
-       last_base_addr = (void *)base_addr + XATTR_SIZE(xnid, inode);
+       last_base_addr = (void *)base_addr + XATTR_SIZE(inode);
 
        list_for_each_xattr(entry, base_addr) {
                const struct xattr_handler *handler =
@@ -609,7 +608,6 @@ static int __f2fs_setxattr(struct inode *inode, int index,
 {
        struct f2fs_xattr_entry *here, *last;
        void *base_addr, *last_base_addr;
-       nid_t xnid = F2FS_I(inode)->i_xattr_nid;
        int found, newsize;
        size_t len;
        __u32 new_hsize;
@@ -633,7 +631,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
        if (error)
                return error;
 
-       last_base_addr = (void *)base_addr + XATTR_SIZE(xnid, inode);
+       last_base_addr = (void *)base_addr + XATTR_SIZE(inode);
 
        /* find entry with wanted name. */
        here = __find_xattr(base_addr, last_base_addr, index, len, name);
index de0c600b9cab0973cf2b8c5ba2b4c9e45da1214c..574beea4649495b625bcc410bb870f7f3ae5ddfb 100644 (file)
@@ -73,7 +73,8 @@ struct f2fs_xattr_entry {
                                entry = XATTR_NEXT_ENTRY(entry))
 #define VALID_XATTR_BLOCK_SIZE (PAGE_SIZE - sizeof(struct node_footer))
 #define XATTR_PADDING_SIZE     (sizeof(__u32))
-#define XATTR_SIZE(x,i)                (((x) ? VALID_XATTR_BLOCK_SIZE : 0) +   \
+#define XATTR_SIZE(i)          ((F2FS_I(i)->i_xattr_nid ?              \
+                                       VALID_XATTR_BLOCK_SIZE : 0) +   \
                                                (inline_xattr_size(i)))
 #define MIN_OFFSET(i)          XATTR_ALIGN(inline_xattr_size(i) +      \
                                                VALID_XATTR_BLOCK_SIZE)