]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/ext4/xattr.c
ext4: revert buggy trim overflow patch
[karo-tx-linux.git] / fs / ext4 / xattr.c
index 04338009793abcfbfa384d1c0f9528cc3236adc6..fc32176eee39ede67320bebeb44a80812d7d0f21 100644 (file)
@@ -427,23 +427,23 @@ cleanup:
 static int
 ext4_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
 {
-       int i_error, b_error;
+       int ret, ret2;
 
        down_read(&EXT4_I(dentry->d_inode)->xattr_sem);
-       i_error = ext4_xattr_ibody_list(dentry, buffer, buffer_size);
-       if (i_error < 0) {
-               b_error = 0;
-       } else {
-               if (buffer) {
-                       buffer += i_error;
-                       buffer_size -= i_error;
-               }
-               b_error = ext4_xattr_block_list(dentry, buffer, buffer_size);
-               if (b_error < 0)
-                       i_error = 0;
+       ret = ret2 = ext4_xattr_ibody_list(dentry, buffer, buffer_size);
+       if (ret < 0)
+               goto errout;
+       if (buffer) {
+               buffer += ret;
+               buffer_size -= ret;
        }
+       ret = ext4_xattr_block_list(dentry, buffer, buffer_size);
+       if (ret < 0)
+               goto errout;
+       ret += ret2;
+errout:
        up_read(&EXT4_I(dentry->d_inode)->xattr_sem);
-       return i_error + b_error;
+       return ret;
 }
 
 /*
@@ -458,8 +458,7 @@ static void ext4_xattr_update_super_block(handle_t *handle,
 
        if (ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh) == 0) {
                EXT4_SET_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_EXT_ATTR);
-               sb->s_dirt = 1;
-               ext4_handle_dirty_metadata(handle, NULL, EXT4_SB(sb)->s_sbh);
+               ext4_handle_dirty_super(handle, sb);
        }
 }
 
@@ -948,7 +947,7 @@ ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
 /*
  * ext4_xattr_set_handle()
  *
- * Create, replace or remove an extended attribute for this inode. Buffer
+ * Create, replace or remove an extended attribute for this inode.  Value
  * is NULL to remove an existing extended attribute, and non-NULL to
  * either replace an existing extended attribute, or create a new extended
  * attribute. The flags XATTR_REPLACE and XATTR_CREATE
@@ -1418,7 +1417,7 @@ ext4_xattr_cache_insert(struct buffer_head *bh)
                ea_bdebug(bh, "out of memory");
                return;
        }
-       error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, &hash);
+       error = mb_cache_entry_insert(ce, bh->b_bdev, bh->b_blocknr, hash);
        if (error) {
                mb_cache_entry_free(ce);
                if (error == -EBUSY) {
@@ -1490,8 +1489,8 @@ ext4_xattr_cache_find(struct inode *inode, struct ext4_xattr_header *header,
                return NULL;  /* never share */
        ea_idebug(inode, "looking for cached blocks [%x]", (int)hash);
 again:
-       ce = mb_cache_entry_find_first(ext4_xattr_cache, 0,
-                                      inode->i_sb->s_bdev, hash);
+       ce = mb_cache_entry_find_first(ext4_xattr_cache, inode->i_sb->s_bdev,
+                                      hash);
        while (ce) {
                struct buffer_head *bh;
 
@@ -1515,7 +1514,7 @@ again:
                        return bh;
                }
                brelse(bh);
-               ce = mb_cache_entry_find_next(ce, 0, inode->i_sb->s_bdev, hash);
+               ce = mb_cache_entry_find_next(ce, inode->i_sb->s_bdev, hash);
        }
        return NULL;
 }
@@ -1589,18 +1588,16 @@ static void ext4_xattr_rehash(struct ext4_xattr_header *header,
 #undef BLOCK_HASH_SHIFT
 
 int __init
-init_ext4_xattr(void)
+ext4_init_xattr(void)
 {
-       ext4_xattr_cache = mb_cache_create("ext4_xattr", NULL,
-               sizeof(struct mb_cache_entry) +
-               sizeof(((struct mb_cache_entry *) 0)->e_indexes[0]), 1, 6);
+       ext4_xattr_cache = mb_cache_create("ext4_xattr", 6);
        if (!ext4_xattr_cache)
                return -ENOMEM;
        return 0;
 }
 
 void
-exit_ext4_xattr(void)
+ext4_exit_xattr(void)
 {
        if (ext4_xattr_cache)
                mb_cache_destroy(ext4_xattr_cache);