Merge tag 'kvm-arm-for-v4.7-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-block.git] / fs / f2fs / xattr.c
index 17fd2b1a6848138bb8d284f56c0ef8f78d39719c..e3decae3acfbba671f9324c5cdc030d4b0400d2f 100644 (file)
@@ -50,10 +50,11 @@ static int f2fs_xattr_generic_get(const struct xattr_handler *handler,
 }
 
 static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
-               struct dentry *dentry, const char *name, const void *value,
+               struct dentry *unused, struct inode *inode,
+               const char *name, const void *value,
                size_t size, int flags)
 {
-       struct f2fs_sb_info *sbi = F2FS_SB(dentry->d_sb);
+       struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb);
 
        switch (handler->flags) {
        case F2FS_XATTR_INDEX_USER:
@@ -69,7 +70,7 @@ static int f2fs_xattr_generic_set(const struct xattr_handler *handler,
        default:
                return -EINVAL;
        }
-       return f2fs_setxattr(d_inode(dentry), handler->flags, name,
+       return f2fs_setxattr(inode, handler->flags, name,
                                        value, size, NULL, flags);
 }
 
@@ -95,11 +96,10 @@ static int f2fs_xattr_advise_get(const struct xattr_handler *handler,
 }
 
 static int f2fs_xattr_advise_set(const struct xattr_handler *handler,
-               struct dentry *dentry, const char *name, const void *value,
+               struct dentry *unused, struct inode *inode,
+               const char *name, const void *value,
                size_t size, int flags)
 {
-       struct inode *inode = d_inode(dentry);
-
        if (!inode_owner_or_capable(inode))
                return -EPERM;
        if (value == NULL)
@@ -498,7 +498,7 @@ static int __f2fs_setxattr(struct inode *inode, int index,
                        free = free + ENTRY_SIZE(here);
 
                if (unlikely(free < newsize)) {
-                       error = -ENOSPC;
+                       error = -E2BIG;
                        goto exit;
                }
        }
@@ -526,7 +526,6 @@ static int __f2fs_setxattr(struct inode *inode, int index,
                 * Before we come here, old entry is removed.
                 * We just write new entry.
                 */
-               memset(last, 0, newsize);
                last->e_name_index = index;
                last->e_name_len = len;
                memcpy(last->e_name, name, len);