ufs: permit mounting of BorderWare filesystems
[safe/jmp/linux-2.6] / fs / ext3 / xattr.c
index 269c7b9..71fb8d6 100644 (file)
@@ -75,7 +75,7 @@
 
 #ifdef EXT3_XATTR_DEBUG
 # define ea_idebug(inode, f...) do { \
-               printk(KERN_DEBUG "inode %s:%ld: ", \
+               printk(KERN_DEBUG "inode %s:%lu: ", \
                        inode->i_sb->s_id, inode->i_ino); \
                printk(f); \
                printk("\n"); \
@@ -99,10 +99,12 @@ static struct buffer_head *ext3_xattr_cache_find(struct inode *,
                                                 struct mb_cache_entry **);
 static void ext3_xattr_rehash(struct ext3_xattr_header *,
                              struct ext3_xattr_entry *);
+static int ext3_xattr_list(struct dentry *dentry, char *buffer,
+                          size_t buffer_size);
 
 static struct mb_cache *ext3_xattr_cache;
 
-static struct xattr_handler *ext3_xattr_handler_map[] = {
+static const struct xattr_handler *ext3_xattr_handler_map[] = {
        [EXT3_XATTR_INDEX_USER]              = &ext3_xattr_user_handler,
 #ifdef CONFIG_EXT3_FS_POSIX_ACL
        [EXT3_XATTR_INDEX_POSIX_ACL_ACCESS]  = &ext3_xattr_acl_access_handler,
@@ -114,7 +116,7 @@ static struct xattr_handler *ext3_xattr_handler_map[] = {
 #endif
 };
 
-struct xattr_handler *ext3_xattr_handlers[] = {
+const struct xattr_handler *ext3_xattr_handlers[] = {
        &ext3_xattr_user_handler,
        &ext3_xattr_trusted_handler,
 #ifdef CONFIG_EXT3_FS_POSIX_ACL
@@ -127,10 +129,10 @@ struct xattr_handler *ext3_xattr_handlers[] = {
        NULL
 };
 
-static inline struct xattr_handler *
+static inline const struct xattr_handler *
 ext3_xattr_handler(int name_index)
 {
-       struct xattr_handler *handler = NULL;
+       const struct xattr_handler *handler = NULL;
 
        if (name_index > 0 && name_index < ARRAY_SIZE(ext3_xattr_handler_map))
                handler = ext3_xattr_handler_map[name_index];
@@ -140,12 +142,12 @@ ext3_xattr_handler(int name_index)
 /*
  * Inode operation listxattr()
  *
- * dentry->d_inode->i_sem: don't care
+ * dentry->d_inode->i_mutex: don't care
  */
 ssize_t
 ext3_listxattr(struct dentry *dentry, char *buffer, size_t size)
 {
-       return ext3_xattr_list(dentry->d_inode, buffer, size);
+       return ext3_xattr_list(dentry, buffer, size);
 }
 
 static int
@@ -210,7 +212,7 @@ ext3_xattr_find_entry(struct ext3_xattr_entry **pentry, int name_index,
        return cmp ? -ENODATA : 0;
 }
 
-int
+static int
 ext3_xattr_block_get(struct inode *inode, int name_index, const char *name,
                     void *buffer, size_t buffer_size)
 {
@@ -225,15 +227,15 @@ ext3_xattr_block_get(struct inode *inode, int name_index, const char *name,
        error = -ENODATA;
        if (!EXT3_I(inode)->i_file_acl)
                goto cleanup;
-       ea_idebug(inode, "reading block %d", EXT3_I(inode)->i_file_acl);
+       ea_idebug(inode, "reading block %u", EXT3_I(inode)->i_file_acl);
        bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl);
        if (!bh)
                goto cleanup;
        ea_bdebug(bh, "b_count=%d, refcount=%d",
                atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
        if (ext3_xattr_check_block(bh)) {
-bad_block:     ext3_error(inode->i_sb, __FUNCTION__,
-                          "inode %ld: bad block %d", inode->i_ino,
+bad_block:     ext3_error(inode->i_sb, __func__,
+                          "inode %lu: bad block "E3FSBLK, inode->i_ino,
                           EXT3_I(inode)->i_file_acl);
                error = -EIO;
                goto cleanup;
@@ -272,7 +274,7 @@ ext3_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
        void *end;
        int error;
 
-       if (!(EXT3_I(inode)->i_state & EXT3_STATE_XATTR))
+       if (!ext3_test_inode_state(inode, EXT3_STATE_XATTR))
                return -ENODATA;
        error = ext3_get_inode_loc(inode, &iloc);
        if (error)
@@ -330,19 +332,20 @@ ext3_xattr_get(struct inode *inode, int name_index, const char *name,
 }
 
 static int
-ext3_xattr_list_entries(struct inode *inode, struct ext3_xattr_entry *entry,
+ext3_xattr_list_entries(struct dentry *dentry, struct ext3_xattr_entry *entry,
                        char *buffer, size_t buffer_size)
 {
        size_t rest = buffer_size;
 
        for (; !IS_LAST_ENTRY(entry); entry = EXT3_XATTR_NEXT(entry)) {
-               struct xattr_handler *handler =
+               const struct xattr_handler *handler =
                        ext3_xattr_handler(entry->e_name_index);
 
                if (handler) {
-                       size_t size = handler->list(inode, buffer, rest,
+                       size_t size = handler->list(dentry, buffer, rest,
                                                    entry->e_name,
-                                                   entry->e_name_len);
+                                                   entry->e_name_len,
+                                                   handler->flags);
                        if (buffer) {
                                if (size > rest)
                                        return -ERANGE;
@@ -354,9 +357,10 @@ ext3_xattr_list_entries(struct inode *inode, struct ext3_xattr_entry *entry,
        return buffer_size - rest;
 }
 
-int
-ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size)
+static int
+ext3_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size)
 {
+       struct inode *inode = dentry->d_inode;
        struct buffer_head *bh = NULL;
        int error;
 
@@ -366,7 +370,7 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size)
        error = 0;
        if (!EXT3_I(inode)->i_file_acl)
                goto cleanup;
-       ea_idebug(inode, "reading block %d", EXT3_I(inode)->i_file_acl);
+       ea_idebug(inode, "reading block %u", EXT3_I(inode)->i_file_acl);
        bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl);
        error = -EIO;
        if (!bh)
@@ -374,14 +378,14 @@ ext3_xattr_block_list(struct inode *inode, char *buffer, size_t buffer_size)
        ea_bdebug(bh, "b_count=%d, refcount=%d",
                atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount));
        if (ext3_xattr_check_block(bh)) {
-               ext3_error(inode->i_sb, __FUNCTION__,
-                          "inode %ld: bad block %d", inode->i_ino,
+               ext3_error(inode->i_sb, __func__,
+                          "inode %lu: bad block "E3FSBLK, inode->i_ino,
                           EXT3_I(inode)->i_file_acl);
                error = -EIO;
                goto cleanup;
        }
        ext3_xattr_cache_insert(bh);
-       error = ext3_xattr_list_entries(inode, BFIRST(bh), buffer, buffer_size);
+       error = ext3_xattr_list_entries(dentry, BFIRST(bh), buffer, buffer_size);
 
 cleanup:
        brelse(bh);
@@ -390,15 +394,16 @@ cleanup:
 }
 
 static int
-ext3_xattr_ibody_list(struct inode *inode, char *buffer, size_t buffer_size)
+ext3_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
 {
+       struct inode *inode = dentry->d_inode;
        struct ext3_xattr_ibody_header *header;
        struct ext3_inode *raw_inode;
        struct ext3_iloc iloc;
        void *end;
        int error;
 
-       if (!(EXT3_I(inode)->i_state & EXT3_STATE_XATTR))
+       if (!ext3_test_inode_state(inode, EXT3_STATE_XATTR))
                return 0;
        error = ext3_get_inode_loc(inode, &iloc);
        if (error)
@@ -409,7 +414,7 @@ ext3_xattr_ibody_list(struct inode *inode, char *buffer, size_t buffer_size)
        error = ext3_xattr_check_names(IFIRST(header), end);
        if (error)
                goto cleanup;
-       error = ext3_xattr_list_entries(inode, IFIRST(header),
+       error = ext3_xattr_list_entries(dentry, IFIRST(header),
                                        buffer, buffer_size);
 
 cleanup:
@@ -427,13 +432,13 @@ cleanup:
  * Returns a negative error number on failure, or the number of bytes
  * used / required on success.
  */
-int
-ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size)
+static int
+ext3_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
 {
        int i_error, b_error;
 
-       down_read(&EXT3_I(inode)->xattr_sem);
-       i_error = ext3_xattr_ibody_list(inode, buffer, buffer_size);
+       down_read(&EXT3_I(dentry->d_inode)->xattr_sem);
+       i_error = ext3_xattr_ibody_list(dentry, buffer, buffer_size);
        if (i_error < 0) {
                b_error = 0;
        } else {
@@ -441,11 +446,11 @@ ext3_xattr_list(struct inode *inode, char *buffer, size_t buffer_size)
                        buffer += i_error;
                        buffer_size -= i_error;
                }
-               b_error = ext3_xattr_block_list(inode, buffer, buffer_size);
+               b_error = ext3_xattr_block_list(dentry, buffer, buffer_size);
                if (b_error < 0)
                        i_error = 0;
        }
-       up_read(&EXT3_I(inode)->xattr_sem);
+       up_read(&EXT3_I(dentry->d_inode)->xattr_sem);
        return i_error + b_error;
 }
 
@@ -459,14 +464,10 @@ static void ext3_xattr_update_super_block(handle_t *handle,
        if (EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_EXT_ATTR))
                return;
 
-       lock_super(sb);
        if (ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh) == 0) {
-               EXT3_SB(sb)->s_es->s_feature_compat |=
-                       cpu_to_le32(EXT3_FEATURE_COMPAT_EXT_ATTR);
-               sb->s_dirt = 1;
+               EXT3_SET_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_EXT_ATTR);
                ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh);
        }
-       unlock_super(sb);
 }
 
 /*
@@ -478,8 +479,15 @@ ext3_xattr_release_block(handle_t *handle, struct inode *inode,
                         struct buffer_head *bh)
 {
        struct mb_cache_entry *ce = NULL;
+       int error = 0;
 
        ce = mb_cache_entry_get(ext3_xattr_cache, bh->b_bdev, bh->b_blocknr);
+       error = ext3_journal_get_write_access(handle, bh);
+       if (error)
+                goto out;
+
+       lock_buffer(bh);
+
        if (BHDR(bh)->h_refcount == cpu_to_le32(1)) {
                ea_bdebug(bh, "refcount now=0; freeing");
                if (ce)
@@ -488,21 +496,20 @@ ext3_xattr_release_block(handle_t *handle, struct inode *inode,
                get_bh(bh);
                ext3_forget(handle, 1, inode, bh, bh->b_blocknr);
        } else {
-               if (ext3_journal_get_write_access(handle, bh) == 0) {
-                       lock_buffer(bh);
-                       BHDR(bh)->h_refcount = cpu_to_le32(
-                               le32_to_cpu(BHDR(bh)->h_refcount) - 1);
-                       ext3_journal_dirty_metadata(handle, bh);
-                       if (IS_SYNC(inode))
-                               handle->h_sync = 1;
-                       DQUOT_FREE_BLOCK(inode, 1);
-                       unlock_buffer(bh);
-                       ea_bdebug(bh, "refcount now=%d; releasing",
-                                 le32_to_cpu(BHDR(bh)->h_refcount));
-               }
+               le32_add_cpu(&BHDR(bh)->h_refcount, -1);
+               error = ext3_journal_dirty_metadata(handle, bh);
+               if (IS_SYNC(inode))
+                       handle->h_sync = 1;
+               dquot_free_block(inode, 1);
+               ea_bdebug(bh, "refcount now=%d; releasing",
+                         le32_to_cpu(BHDR(bh)->h_refcount));
                if (ce)
                        mb_cache_entry_release(ce);
        }
+       unlock_buffer(bh);
+out:
+       ext3_std_error(inode->i_sb, error);
+       return;
 }
 
 struct ext3_xattr_info {
@@ -626,7 +633,7 @@ struct ext3_xattr_block_find {
        struct buffer_head *bh;
 };
 
-int
+static int
 ext3_xattr_block_find(struct inode *inode, struct ext3_xattr_info *i,
                      struct ext3_xattr_block_find *bs)
 {
@@ -646,8 +653,8 @@ ext3_xattr_block_find(struct inode *inode, struct ext3_xattr_info *i,
                        atomic_read(&(bs->bh->b_count)),
                        le32_to_cpu(BHDR(bs->bh)->h_refcount));
                if (ext3_xattr_check_block(bs->bh)) {
-                       ext3_error(sb, __FUNCTION__,
-                               "inode %ld: bad block %d", inode->i_ino,
+                       ext3_error(sb, __func__,
+                               "inode %lu: bad block "E3FSBLK, inode->i_ino,
                                EXT3_I(inode)->i_file_acl);
                        error = -EIO;
                        goto cleanup;
@@ -678,7 +685,7 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
        struct buffer_head *new_bh = NULL;
        struct ext3_xattr_search *s = &bs->s;
        struct mb_cache_entry *ce = NULL;
-       int error;
+       int error = 0;
 
 #define header(x) ((struct ext3_xattr_header *)(x))
 
@@ -687,16 +694,17 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
        if (s->base) {
                ce = mb_cache_entry_get(ext3_xattr_cache, bs->bh->b_bdev,
                                        bs->bh->b_blocknr);
+               error = ext3_journal_get_write_access(handle, bs->bh);
+               if (error)
+                       goto cleanup;
+               lock_buffer(bs->bh);
+
                if (header(s->base)->h_refcount == cpu_to_le32(1)) {
                        if (ce) {
                                mb_cache_entry_free(ce);
                                ce = NULL;
                        }
                        ea_bdebug(bs->bh, "modifying in-place");
-                       error = ext3_journal_get_write_access(handle, bs->bh);
-                       if (error)
-                               goto cleanup;
-                       lock_buffer(bs->bh);
                        error = ext3_xattr_set_entry(i, s);
                        if (!error) {
                                if (!IS_LAST_ENTRY(s->first))
@@ -716,12 +724,15 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
                } else {
                        int offset = (char *)s->here - bs->bh->b_data;
 
+                       unlock_buffer(bs->bh);
+                       journal_release_buffer(handle, bs->bh);
+
                        if (ce) {
                                mb_cache_entry_release(ce);
                                ce = NULL;
                        }
                        ea_bdebug(bs->bh, "cloning");
-                       s->base = kmalloc(bs->bh->b_size, GFP_KERNEL);
+                       s->base = kmalloc(bs->bh->b_size, GFP_NOFS);
                        error = -ENOMEM;
                        if (s->base == NULL)
                                goto cleanup;
@@ -733,12 +744,11 @@ ext3_xattr_block_set(handle_t *handle, struct inode *inode,
                }
        } else {
                /* Allocate a buffer where we construct the new block. */
-               s->base = kmalloc(sb->s_blocksize, GFP_KERNEL);
+               s->base = kzalloc(sb->s_blocksize, GFP_NOFS);
                /* assert(header == s->base) */
                error = -ENOMEM;
                if (s->base == NULL)
                        goto cleanup;
-               memset(s->base, 0, sb->s_blocksize);
                header(s->base)->h_magic = cpu_to_le32(EXT3_XATTR_MAGIC);
                header(s->base)->h_blocks = cpu_to_le32(1);
                header(s->base)->h_refcount = cpu_to_le32(1);
@@ -765,16 +775,15 @@ inserted:
                        else {
                                /* The old block is released after updating
                                   the inode. */
-                               error = -EDQUOT;
-                               if (DQUOT_ALLOC_BLOCK(inode, 1))
+                               error = dquot_alloc_block(inode, 1);
+                               if (error)
                                        goto cleanup;
                                error = ext3_journal_get_write_access(handle,
                                                                      new_bh);
                                if (error)
                                        goto cleanup_dquot;
                                lock_buffer(new_bh);
-                               BHDR(new_bh)->h_refcount = cpu_to_le32(1 +
-                                       le32_to_cpu(BHDR(new_bh)->h_refcount));
+                               le32_add_cpu(&BHDR(new_bh)->h_refcount, 1);
                                ea_bdebug(new_bh, "reusing; refcount now=%d",
                                        le32_to_cpu(BHDR(new_bh)->h_refcount));
                                unlock_buffer(new_bh);
@@ -792,11 +801,10 @@ inserted:
                        get_bh(new_bh);
                } else {
                        /* We need to allocate a new block */
-                       int goal = le32_to_cpu(
-                                       EXT3_SB(sb)->s_es->s_first_data_block) +
-                               EXT3_I(inode)->i_block_group *
-                               EXT3_BLOCKS_PER_GROUP(sb);
-                       int block = ext3_new_block(handle, inode, goal, &error);
+                       ext3_fsblk_t goal = ext3_group_first_block_no(sb,
+                                               EXT3_I(inode)->i_block_group);
+                       ext3_fsblk_t block = ext3_new_block(handle, inode,
+                                                       goal, &error);
                        if (error)
                                goto cleanup;
                        ea_idebug(inode, "creating block %d", block);
@@ -842,12 +850,12 @@ cleanup:
        return error;
 
 cleanup_dquot:
-       DQUOT_FREE_BLOCK(inode, 1);
+       dquot_free_block(inode, 1);
        goto cleanup;
 
 bad_block:
-       ext3_error(inode->i_sb, __FUNCTION__,
-                  "inode %ld: bad block %d", inode->i_ino,
+       ext3_error(inode->i_sb, __func__,
+                  "inode %lu: bad block "E3FSBLK, inode->i_ino,
                   EXT3_I(inode)->i_file_acl);
        goto cleanup;
 
@@ -859,7 +867,7 @@ struct ext3_xattr_ibody_find {
        struct ext3_iloc iloc;
 };
 
-int
+static int
 ext3_xattr_ibody_find(struct inode *inode, struct ext3_xattr_info *i,
                      struct ext3_xattr_ibody_find *is)
 {
@@ -874,7 +882,7 @@ ext3_xattr_ibody_find(struct inode *inode, struct ext3_xattr_info *i,
        is->s.base = is->s.first = IFIRST(header);
        is->s.here = is->s.first;
        is->s.end = (void *)raw_inode + EXT3_SB(inode->i_sb)->s_inode_size;
-       if (EXT3_I(inode)->i_state & EXT3_STATE_XATTR) {
+       if (ext3_test_inode_state(inode, EXT3_STATE_XATTR)) {
                error = ext3_xattr_check_names(IFIRST(header), is->s.end);
                if (error)
                        return error;
@@ -906,10 +914,10 @@ ext3_xattr_ibody_set(handle_t *handle, struct inode *inode,
        header = IHDR(inode, ext3_raw_inode(&is->iloc));
        if (!IS_LAST_ENTRY(s->first)) {
                header->h_magic = cpu_to_le32(EXT3_XATTR_MAGIC);
-               EXT3_I(inode)->i_state |= EXT3_STATE_XATTR;
+               ext3_set_inode_state(inode, EXT3_STATE_XATTR);
        } else {
                header->h_magic = cpu_to_le32(0);
-               EXT3_I(inode)->i_state &= ~EXT3_STATE_XATTR;
+               ext3_clear_inode_state(inode, EXT3_STATE_XATTR);
        }
        return 0;
 }
@@ -946,10 +954,6 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
        };
        int error;
 
-       if (IS_RDONLY(inode))
-               return -EROFS;
-       if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
-               return -EPERM;
        if (!name)
                return -EINVAL;
        if (strlen(name) > 255)
@@ -959,10 +963,14 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
        if (error)
                goto cleanup;
 
-       if (EXT3_I(inode)->i_state & EXT3_STATE_NEW) {
+       error = ext3_journal_get_write_access(handle, is.iloc.bh);
+       if (error)
+               goto cleanup;
+
+       if (ext3_test_inode_state(inode, EXT3_STATE_NEW)) {
                struct ext3_inode *raw_inode = ext3_raw_inode(&is.iloc);
                memset(raw_inode, 0, EXT3_SB(inode->i_sb)->s_inode_size);
-               EXT3_I(inode)->i_state &= ~EXT3_STATE_NEW;
+               ext3_clear_inode_state(inode, EXT3_STATE_NEW);
        }
 
        error = ext3_xattr_ibody_find(inode, &i, &is);
@@ -984,9 +992,6 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
                if (flags & XATTR_CREATE)
                        goto cleanup;
        }
-       error = ext3_journal_get_write_access(handle, is.iloc.bh);
-       if (error)
-               goto cleanup;
        if (!value) {
                if (!is.s.not_found)
                        error = ext3_xattr_ibody_set(handle, inode, &i, &is);
@@ -998,6 +1003,11 @@ ext3_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
                        i.value = NULL;
                        error = ext3_xattr_block_set(handle, inode, &i, &bs);
                } else if (error == -ENOSPC) {
+                       if (EXT3_I(inode)->i_file_acl && !bs.s.base) {
+                               error = ext3_xattr_block_find(inode, &i, &bs);
+                               if (error)
+                                       goto cleanup;
+                       }
                        error = ext3_xattr_block_set(handle, inode, &i, &bs);
                        if (error)
                                goto cleanup;
@@ -1079,15 +1089,15 @@ ext3_xattr_delete_inode(handle_t *handle, struct inode *inode)
                goto cleanup;
        bh = sb_bread(inode->i_sb, EXT3_I(inode)->i_file_acl);
        if (!bh) {
-               ext3_error(inode->i_sb, __FUNCTION__,
-                       "inode %ld: block %d read error", inode->i_ino,
+               ext3_error(inode->i_sb, __func__,
+                       "inode %lu: block "E3FSBLK" read error", inode->i_ino,
                        EXT3_I(inode)->i_file_acl);
                goto cleanup;
        }
        if (BHDR(bh)->h_magic != cpu_to_le32(EXT3_XATTR_MAGIC) ||
            BHDR(bh)->h_blocks != cpu_to_le32(1)) {
-               ext3_error(inode->i_sb, __FUNCTION__,
-                       "inode %ld: bad block %d", inode->i_ino,
+               ext3_error(inode->i_sb, __func__,
+                       "inode %lu: bad block "E3FSBLK, inode->i_ino,
                        EXT3_I(inode)->i_file_acl);
                goto cleanup;
        }
@@ -1124,7 +1134,7 @@ ext3_xattr_cache_insert(struct buffer_head *bh)
        struct mb_cache_entry *ce;
        int error;
 
-       ce = mb_cache_entry_alloc(ext3_xattr_cache);
+       ce = mb_cache_entry_alloc(ext3_xattr_cache, GFP_NOFS);
        if (!ce) {
                ea_bdebug(bh, "out of memory");
                return;
@@ -1213,12 +1223,12 @@ again:
                }
                bh = sb_bread(inode->i_sb, ce->e_block);
                if (!bh) {
-                       ext3_error(inode->i_sb, __FUNCTION__,
-                               "inode %ld: block %ld read error",
+                       ext3_error(inode->i_sb, __func__,
+                               "inode %lu: block %lu read error",
                                inode->i_ino, (unsigned long) ce->e_block);
                } else if (le32_to_cpu(BHDR(bh)->h_refcount) >=
                                EXT3_XATTR_REFCOUNT_MAX) {
-                       ea_idebug(inode, "block %ld refcount %d>=%d",
+                       ea_idebug(inode, "block %lu refcount %d>=%d",
                                  (unsigned long) ce->e_block,
                                  le32_to_cpu(BHDR(bh)->h_refcount),
                                          EXT3_XATTR_REFCOUNT_MAX);