diff options
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/bitmap.c | 8 | ||||
-rw-r--r-- | fs/reiserfs/do_balan.c | 14 | ||||
-rw-r--r-- | fs/reiserfs/ioctl.c | 4 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 10 | ||||
-rw-r--r-- | fs/reiserfs/namei.c | 8 | ||||
-rw-r--r-- | fs/reiserfs/objectid.c | 7 | ||||
-rw-r--r-- | fs/reiserfs/stree.c | 3 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 38 |
8 files changed, 52 insertions, 40 deletions
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index f491ceb5af02..4646caa60455 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c @@ -479,7 +479,7 @@ static void __discard_prealloc(struct reiserfs_transaction_handle *th, if (ei->i_prealloc_count < 0) reiserfs_warning(th->t_super, "zam-4001:%s: inode has negative prealloc blocks count.", - __FUNCTION__); + __func__); #endif while (ei->i_prealloc_count > 0) { reiserfs_free_prealloc_block(th, inode, ei->i_prealloc_block); @@ -517,7 +517,7 @@ void reiserfs_discard_all_prealloc(struct reiserfs_transaction_handle *th) if (!ei->i_prealloc_count) { reiserfs_warning(th->t_super, "zam-4001:%s: inode is in prealloc list but has no preallocated blocks.", - __FUNCTION__); + __func__); } #endif __discard_prealloc(th, ei); @@ -632,7 +632,7 @@ int reiserfs_parse_alloc_options(struct super_block *s, char *options) } reiserfs_warning(s, "zam-4001: %s : unknown option - %s", - __FUNCTION__, this_char); + __func__, this_char); return 1; } @@ -1254,7 +1254,7 @@ struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, bh = sb_bread(sb, block); if (bh == NULL) reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%u) " - "reading failed", __FUNCTION__, block); + "reading failed", __func__, block); else { if (buffer_locked(bh)) { PROC_INFO_INC(sb, scan_bitmap.wait); diff --git a/fs/reiserfs/do_balan.c b/fs/reiserfs/do_balan.c index 7ee4208793b6..2f87f5b14630 100644 --- a/fs/reiserfs/do_balan.c +++ b/fs/reiserfs/do_balan.c @@ -1464,29 +1464,29 @@ static int balance_leaf(struct tree_balance *tb, struct item_head *ih, /* item h } else /* item falls wholly into S_new[i] */ { - int ret_val; + int leaf_mi; struct item_head *pasted; #ifdef CONFIG_REISERFS_CHECK - struct item_head *ih = + struct item_head *ih_check = B_N_PITEM_HEAD(tbS0, item_pos); - if (!is_direntry_le_ih(ih) - && (pos_in_item != ih_item_len(ih) + if (!is_direntry_le_ih(ih_check) + && (pos_in_item != ih_item_len(ih_check) || tb->insert_size[0] <= 0)) reiserfs_panic(tb->tb_sb, "PAP-12235: balance_leaf: pos_in_item must be equal to ih_item_len"); #endif /* CONFIG_REISERFS_CHECK */ - ret_val = + leaf_mi = leaf_move_items(LEAF_FROM_S_TO_SNEW, tb, snum[i], sbytes[i], S_new[i]); - RFALSE(ret_val, + RFALSE(leaf_mi, "PAP-12240: unexpected value returned by leaf_move_items (%d)", - ret_val); + leaf_mi); /* paste into item */ bi.tb = tb; diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 74363a7aacbc..830332021ed4 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c @@ -12,8 +12,6 @@ #include <linux/smp_lock.h> #include <linux/compat.h> -static int reiserfs_unpack(struct inode *inode, struct file *filp); - /* ** reiserfs_ioctl - handler for ioctl for inode ** supported commands: @@ -159,7 +157,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page, ** Function try to convert tail from direct item into indirect. ** It set up nopack attribute in the REISERFS_I(inode)->nopack */ -static int reiserfs_unpack(struct inode *inode, struct file *filp) +int reiserfs_unpack(struct inode *inode, struct file *filp) { int retval = 0; int index; diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 060eb3f598e7..da86042b3e03 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c @@ -1187,7 +1187,7 @@ static int flush_commit_list(struct super_block *s, if (retval) reiserfs_abort(s, retval, "Journal write error in %s", - __FUNCTION__); + __func__); put_fs_excl(); return retval; } @@ -1534,7 +1534,7 @@ static int flush_journal_list(struct super_block *s, reiserfs_warning(s, "clm-2082: Unable to flush buffer %llu in %s", (unsigned long long)saved_bh-> - b_blocknr, __FUNCTION__); + b_blocknr, __func__); } free_cnode: last = cn; @@ -1586,7 +1586,7 @@ static int flush_journal_list(struct super_block *s, if (err) reiserfs_abort(s, -EIO, "Write error while pushing transaction to disk in %s", - __FUNCTION__); + __func__); flush_older_and_return: /* before we can update the journal header block, we _must_ flush all @@ -1616,7 +1616,7 @@ static int flush_journal_list(struct super_block *s, if (err) reiserfs_abort(s, -EIO, "Write error while updating journal header in %s", - __FUNCTION__); + __func__); } remove_all_from_journal_list(s, jl, 0); list_del_init(&jl->j_list); @@ -4316,5 +4316,5 @@ static void __reiserfs_journal_abort_soft(struct super_block *sb, int errno) void reiserfs_journal_abort(struct super_block *sb, int errno) { - return __reiserfs_journal_abort_soft(sb, errno); + __reiserfs_journal_abort_soft(sb, errno); } diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 8867533cb727..c1add28dd45e 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c @@ -301,7 +301,7 @@ static int reiserfs_find_entry(struct inode *dir, const char *name, int namelen, path_to_entry, de); if (retval == IO_ERROR) { reiserfs_warning(dir->i_sb, "zam-7001: io error in %s", - __FUNCTION__); + __func__); return IO_ERROR; } @@ -496,7 +496,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th, reiserfs_warning(dir->i_sb, "zam-7002:%s: \"reiserfs_find_entry\" " "has returned unexpected value (%d)", - __FUNCTION__, retval); + __func__, retval); } return -EEXIST; @@ -907,7 +907,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry) if (inode->i_nlink != 2 && inode->i_nlink != 1) reiserfs_warning(inode->i_sb, "%s: empty directory has nlink " - "!= 2 (%d)", __FUNCTION__, inode->i_nlink); + "!= 2 (%d)", __func__, inode->i_nlink); clear_nlink(inode); inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC; @@ -984,7 +984,7 @@ static int reiserfs_unlink(struct inode *dir, struct dentry *dentry) if (!inode->i_nlink) { reiserfs_warning(inode->i_sb, "%s: deleting nonexistent file " - "(%s:%lu), %d", __FUNCTION__, + "(%s:%lu), %d", __func__, reiserfs_bdevname(inode->i_sb), inode->i_ino, inode->i_nlink); inode->i_nlink = 1; diff --git a/fs/reiserfs/objectid.c b/fs/reiserfs/objectid.c index 65feba4deb69..ea0cf8c28a99 100644 --- a/fs/reiserfs/objectid.c +++ b/fs/reiserfs/objectid.c @@ -61,7 +61,7 @@ __u32 reiserfs_get_unused_objectid(struct reiserfs_transaction_handle *th) /* comment needed -Hans */ unused_objectid = le32_to_cpu(map[1]); if (unused_objectid == U32_MAX) { - reiserfs_warning(s, "%s: no more object ids", __FUNCTION__); + reiserfs_warning(s, "%s: no more object ids", __func__); reiserfs_restore_prepared_buffer(s, SB_BUFFER_WITH_SB(s)); return 0; } @@ -114,7 +114,7 @@ void reiserfs_release_objectid(struct reiserfs_transaction_handle *th, if (objectid_to_release == le32_to_cpu(map[i])) { /* This incrementation unallocates the objectid. */ //map[i]++; - map[i] = cpu_to_le32(le32_to_cpu(map[i]) + 1); + le32_add_cpu(&map[i], 1); /* Did we unallocate the last member of an odd sequence, and can shrink oids? */ if (map[i] == map[i + 1]) { @@ -138,8 +138,7 @@ void reiserfs_release_objectid(struct reiserfs_transaction_handle *th, /* size of objectid map is not changed */ if (objectid_to_release + 1 == le32_to_cpu(map[i + 1])) { //objectid_map[i+1]--; - map[i + 1] = - cpu_to_le32(le32_to_cpu(map[i + 1]) - 1); + le32_add_cpu(&map[i + 1], -1); return; } diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index d2db2417b2bd..abbc64dcc8d4 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c @@ -1419,8 +1419,7 @@ int reiserfs_delete_object(struct reiserfs_transaction_handle *th, inode_generation = &REISERFS_SB(th->t_super)->s_rs->s_inode_generation; - *inode_generation = - cpu_to_le32(le32_to_cpu(*inode_generation) + 1); + le32_add_cpu(inode_generation, 1); } /* USE_INODE_GENERATION_COUNTER */ #endif diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 393cc22c1717..ed424d708e69 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -304,7 +304,7 @@ static int finish_unfinished(struct super_block *s) /* Turn quotas off */ for (i = 0; i < MAXQUOTAS; i++) { if (sb_dqopt(s)->files[i]) - vfs_quota_off_mount(s, i); + vfs_quota_off(s, i, 0); } if (ms_active_set) /* Restore the flag back */ @@ -634,7 +634,7 @@ static int reiserfs_acquire_dquot(struct dquot *); static int reiserfs_release_dquot(struct dquot *); static int reiserfs_mark_dquot_dirty(struct dquot *); static int reiserfs_write_info(struct super_block *, int); -static int reiserfs_quota_on(struct super_block *, int, int, char *); +static int reiserfs_quota_on(struct super_block *, int, int, char *, int); static struct dquot_operations reiserfs_quota_operations = { .initialize = reiserfs_dquot_initialize, @@ -1890,8 +1890,14 @@ static int reiserfs_dquot_drop(struct inode *inode) ret = journal_begin(&th, inode->i_sb, 2 * REISERFS_QUOTA_DEL_BLOCKS(inode->i_sb)); - if (ret) + if (ret) { + /* + * We call dquot_drop() anyway to at least release references + * to quota structures so that umount does not hang. + */ + dquot_drop(inode); goto out; + } ret = dquot_drop(inode); err = journal_end(&th, inode->i_sb, @@ -2015,13 +2021,17 @@ static int reiserfs_quota_on_mount(struct super_block *sb, int type) * Standard function to be called on quota_on */ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, - char *path) + char *path, int remount) { int err; struct nameidata nd; + struct inode *inode; if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) return -EINVAL; + /* No more checks needed? Path and format_id are bogus anyway... */ + if (remount) + return vfs_quota_on(sb, type, format_id, path, 1); err = path_lookup(path, LOOKUP_FOLLOW, &nd); if (err) return err; @@ -2030,18 +2040,24 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, path_put(&nd.path); return -EXDEV; } + inode = nd.path.dentry->d_inode; /* We must not pack tails for quota files on reiserfs for quota IO to work */ - if (!(REISERFS_I(nd.path.dentry->d_inode)->i_flags & i_nopack_mask)) { - reiserfs_warning(sb, - "reiserfs: Quota file must have tail packing disabled."); - path_put(&nd.path); - return -EINVAL; + if (!(REISERFS_I(inode)->i_flags & i_nopack_mask)) { + err = reiserfs_unpack(inode, NULL); + if (err) { + reiserfs_warning(sb, + "reiserfs: Unpacking tail of quota file failed" + " (%d). Cannot turn on quotas.", err); + path_put(&nd.path); + return -EINVAL; + } + mark_inode_dirty(inode); } /* Not journalling quota? No more tests needed... */ if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) { path_put(&nd.path); - return vfs_quota_on(sb, type, format_id, path); + return vfs_quota_on(sb, type, format_id, path, 0); } /* Quotafile not of fs root? */ if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) @@ -2049,7 +2065,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, "reiserfs: Quota file not on filesystem root. " "Journalled quota will not work."); path_put(&nd.path); - return vfs_quota_on(sb, type, format_id, path); + return vfs_quota_on(sb, type, format_id, path, 0); } /* Read data from quotafile - avoid pagecache and such because we cannot afford |