]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/reiserfs/super.c
proc: convert /proc/$PID/hardwall to seq_file interface
[karo-tx-linux.git] / fs / reiserfs / super.c
index aa8a97b6e6d896d88634a35822d7623a8b430023..709ea92d716f03ca78b7e45b6f2677ac50b3ba1d 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
 #include <linux/time.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
 #include "reiserfs.h"
 #include "acl.h"
 #include "xattr.h"
@@ -74,7 +74,7 @@ static int reiserfs_sync_fs(struct super_block *s, int wait)
        dquot_writeback_dquots(s, -1);
        reiserfs_write_lock(s);
        if (!journal_begin(&th, s, 1))
-               if (!journal_end_sync(&th, s))
+               if (!journal_end_sync(&th))
                        reiserfs_flush_old_commits(s);
        reiserfs_write_unlock(s);
        return 0;
@@ -136,9 +136,9 @@ static int reiserfs_freeze(struct super_block *s)
                } else {
                        reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s),
                                                     1);
-                       journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
+                       journal_mark_dirty(&th, SB_BUFFER_WITH_SB(s));
                        reiserfs_block_writes(&th);
-                       journal_end_sync(&th, s);
+                       journal_end_sync(&th);
                }
        }
        reiserfs_write_unlock(s);
@@ -178,7 +178,7 @@ static int remove_save_link_only(struct super_block *s,
                /* removals are protected by direct items */
                reiserfs_release_objectid(&th, le32_to_cpu(key->k_objectid));
 
-       return journal_end(&th, s);
+       return journal_end(&th);
 }
 
 #ifdef CONFIG_QUOTA
@@ -331,7 +331,7 @@ static int finish_unfinished(struct super_block *s)
                         * not completed truncate found. New size was
                         * committed together with "save" link
                         */
-                       reiserfs_info(s, "Truncating %k to %Ld ..",
+                       reiserfs_info(s, "Truncating %k to %lld ..",
                                      INODE_PKEY(inode), inode->i_size);
 
                        /* don't update modification time */
@@ -506,7 +506,7 @@ int remove_save_link(struct inode *inode, int truncate)
        } else
                REISERFS_I(inode)->i_flags &= ~i_link_saved_truncate_mask;
 
-       return journal_end(&th, inode->i_sb);
+       return journal_end(&th);
 }
 
 static void reiserfs_kill_sb(struct super_block *s)
@@ -551,7 +551,7 @@ static void reiserfs_put_super(struct super_block *s)
                                                     1);
                        set_sb_umount_state(SB_DISK_SUPER_BLOCK(s),
                                            REISERFS_SB(s)->s_mount_state);
-                       journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
+                       journal_mark_dirty(&th, SB_BUFFER_WITH_SB(s));
                }
        }
 
@@ -659,7 +659,7 @@ static void reiserfs_dirty_inode(struct inode *inode, int flags)
                goto out;
 
        reiserfs_update_sd(&th, inode);
-       journal_end(&th, inode->i_sb);
+       journal_end(&th);
 
 out:
        reiserfs_write_unlock(inode->i_sb);
@@ -1477,7 +1477,7 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
                /* Mounting a rw partition read-only. */
                reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), 1);
                set_sb_umount_state(rs, REISERFS_SB(s)->s_mount_state);
-               journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
+               journal_mark_dirty(&th, SB_BUFFER_WITH_SB(s));
        } else {
                /* remount read-write */
                if (!(s->s_flags & MS_RDONLY)) {
@@ -1509,12 +1509,12 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg)
                if (!old_format_only(s))
                        set_sb_mnt_count(rs, sb_mnt_count(rs) + 1);
                /* mark_buffer_dirty (SB_BUFFER_WITH_SB (s), 1); */
-               journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
+               journal_mark_dirty(&th, SB_BUFFER_WITH_SB(s));
                REISERFS_SB(s)->s_mount_state = REISERFS_VALID_FS;
        }
        /* this will force a full flush of all journal lists */
        SB_JOURNAL(s)->j_must_wait = 1;
-       err = journal_end(&th, s);
+       err = journal_end(&th);
        if (err)
                goto out_err_unlock;
 
@@ -1577,7 +1577,7 @@ static int read_super_block(struct super_block *s, int offset)
        rs = (struct reiserfs_super_block *)bh->b_data;
        if (sb_blocksize(rs) != s->s_blocksize) {
                reiserfs_warning(s, "sh-2011", "can't find a reiserfs "
-                                "filesystem on (dev %s, block %Lu, size %lu)",
+                                "filesystem on (dev %s, block %llu, size %lu)",
                                 s->s_id,
                                 (unsigned long long)bh->b_blocknr,
                                 s->s_blocksize);
@@ -1642,7 +1642,7 @@ static int read_super_block(struct super_block *s, int offset)
 /* after journal replay, reread all bitmap and super blocks */
 static int reread_meta_blocks(struct super_block *s)
 {
-       ll_rw_block(READ, 1, &(SB_BUFFER_WITH_SB(s)));
+       ll_rw_block(READ, 1, &SB_BUFFER_WITH_SB(s));
        wait_on_buffer(SB_BUFFER_WITH_SB(s));
        if (!buffer_uptodate(SB_BUFFER_WITH_SB(s))) {
                reiserfs_warning(s, "reiserfs-2504", "error reading the super");
@@ -1668,71 +1668,60 @@ static __u32 find_hash_out(struct super_block *s)
        struct cpu_key key;
        INITIALIZE_PATH(path);
        struct reiserfs_dir_entry de;
+       struct reiserfs_de_head *deh;
        __u32 hash = DEFAULT_HASH;
+       __u32 deh_hashval, teahash, r5hash, yurahash;
 
        inode = s->s_root->d_inode;
 
-       do {                    /* Some serious "goto"-hater was there ;) */
-               u32 teahash, r5hash, yurahash;
+       make_cpu_key(&key, inode, ~0, TYPE_DIRENTRY, 3);
+       retval = search_by_entry_key(s, &key, &path, &de);
+       if (retval == IO_ERROR) {
+               pathrelse(&path);
+               return UNSET_HASH;
+       }
+       if (retval == NAME_NOT_FOUND)
+               de.de_entry_num--;
 
-               make_cpu_key(&key, inode, ~0, TYPE_DIRENTRY, 3);
-               retval = search_by_entry_key(s, &key, &path, &de);
-               if (retval == IO_ERROR) {
-                       pathrelse(&path);
-                       return UNSET_HASH;
-               }
-               if (retval == NAME_NOT_FOUND)
-                       de.de_entry_num--;
-               set_de_name_and_namelen(&de);
-               if (deh_offset(&(de.de_deh[de.de_entry_num])) == DOT_DOT_OFFSET) {
-                       /* allow override in this case */
-                       if (reiserfs_rupasov_hash(s)) {
-                               hash = YURA_HASH;
-                       }
-                       reiserfs_info(s, "FS seems to be empty, autodetect "
-                                        "is using the default hash\n");
-                       break;
-               }
-               r5hash = GET_HASH_VALUE(r5_hash(de.de_name, de.de_namelen));
-               teahash = GET_HASH_VALUE(keyed_hash(de.de_name, de.de_namelen));
-               yurahash = GET_HASH_VALUE(yura_hash(de.de_name, de.de_namelen));
-               if (((teahash == r5hash)
-                    &&
-                    (GET_HASH_VALUE(deh_offset(&(de.de_deh[de.de_entry_num])))
-                     == r5hash)) || ((teahash == yurahash)
-                                     && (yurahash ==
-                                         GET_HASH_VALUE(deh_offset
-                                                        (&
-                                                         (de.
-                                                          de_deh[de.
-                                                                 de_entry_num])))))
-                   || ((r5hash == yurahash)
-                       && (yurahash ==
-                           GET_HASH_VALUE(deh_offset
-                                          (&(de.de_deh[de.de_entry_num])))))) {
-                       reiserfs_warning(s, "reiserfs-2506", "Unable to "
-                                        "automatically detect hash function. "
-                                        "Please mount with -o "
-                                        "hash={tea,rupasov,r5}");
-                       hash = UNSET_HASH;
-                       break;
-               }
-               if (GET_HASH_VALUE(deh_offset(&(de.de_deh[de.de_entry_num]))) ==
-                   yurahash)
+       set_de_name_and_namelen(&de);
+       deh = de.de_deh + de.de_entry_num;
+
+       if (deh_offset(deh) == DOT_DOT_OFFSET) {
+               /* allow override in this case */
+               if (reiserfs_rupasov_hash(s))
                        hash = YURA_HASH;
-               else if (GET_HASH_VALUE
-                        (deh_offset(&(de.de_deh[de.de_entry_num]))) == teahash)
-                       hash = TEA_HASH;
-               else if (GET_HASH_VALUE
-                        (deh_offset(&(de.de_deh[de.de_entry_num]))) == r5hash)
-                       hash = R5_HASH;
-               else {
-                       reiserfs_warning(s, "reiserfs-2506",
-                                        "Unrecognised hash function");
-                       hash = UNSET_HASH;
-               }
-       } while (0);
+               reiserfs_info(s, "FS seems to be empty, autodetect is using the default hash\n");
+               goto out;
+       }
 
+       deh_hashval = GET_HASH_VALUE(deh_offset(deh));
+       r5hash = GET_HASH_VALUE(r5_hash(de.de_name, de.de_namelen));
+       teahash = GET_HASH_VALUE(keyed_hash(de.de_name, de.de_namelen));
+       yurahash = GET_HASH_VALUE(yura_hash(de.de_name, de.de_namelen));
+
+       if ((teahash == r5hash && deh_hashval == r5hash) ||
+           (teahash == yurahash && deh_hashval == yurahash) ||
+           (r5hash == yurahash && deh_hashval == yurahash)) {
+               reiserfs_warning(s, "reiserfs-2506",
+                                "Unable to automatically detect hash "
+                                "function. Please mount with -o "
+                                "hash={tea,rupasov,r5}");
+               hash = UNSET_HASH;
+               goto out;
+       }
+
+       if (deh_hashval == yurahash)
+               hash = YURA_HASH;
+       else if (deh_hashval == teahash)
+               hash = TEA_HASH;
+       else if (deh_hashval == r5hash)
+               hash = R5_HASH;
+       else {
+               reiserfs_warning(s, "reiserfs-2506",
+                                "Unrecognised hash function");
+               hash = UNSET_HASH;
+       }
+out:
        pathrelse(&path);
        return hash;
 }
@@ -1886,7 +1875,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
 
        jdev_name = NULL;
        if (reiserfs_parse_options
-           (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name,
+           (s, (char *)data, &sbi->s_mount_opt, &blocks, &jdev_name,
             &commit_max_age, qf_names, &qfmt) == 0) {
                goto error_unlocked;
        }
@@ -2003,7 +1992,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
        args.dirid = REISERFS_ROOT_PARENT_OBJECTID;
        root_inode =
            iget5_locked(s, REISERFS_ROOT_OBJECTID, reiserfs_find_actor,
-                        reiserfs_init_locked_inode, (void *)(&args));
+                        reiserfs_init_locked_inode, (void *)&args);
        if (!root_inode) {
                SWARN(silent, s, "jmacd-10", "get root inode failed");
                goto error_unlocked;
@@ -2037,11 +2026,11 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
 
        if (is_reiserfs_3_5(rs)
            || (is_reiserfs_jr(rs) && SB_VERSION(s) == REISERFS_VERSION_1))
-               set_bit(REISERFS_3_5, &(sbi->s_properties));
+               set_bit(REISERFS_3_5, &sbi->s_properties);
        else if (old_format)
-               set_bit(REISERFS_OLD_FORMAT, &(sbi->s_properties));
+               set_bit(REISERFS_OLD_FORMAT, &sbi->s_properties);
        else
-               set_bit(REISERFS_3_6, &(sbi->s_properties));
+               set_bit(REISERFS_3_6, &sbi->s_properties);
 
        if (!(s->s_flags & MS_RDONLY)) {
 
@@ -2097,8 +2086,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
 
                                set_sb_version(rs, REISERFS_VERSION_2);
                                reiserfs_convert_objectid_map_v1(s);
-                               set_bit(REISERFS_3_6, &(sbi->s_properties));
-                               clear_bit(REISERFS_3_5, &(sbi->s_properties));
+                               set_bit(REISERFS_3_6, &sbi->s_properties);
+                               clear_bit(REISERFS_3_5, &sbi->s_properties);
                        } else if (!silent) {
                                reiserfs_info(s, "using 3.5.x disk format\n");
                        }
@@ -2106,8 +2095,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent)
                        set_sb_mnt_count(rs, sb_mnt_count(rs) + 1);
 
 
-               journal_mark_dirty(&th, s, SB_BUFFER_WITH_SB(s));
-               errval = journal_end(&th, s);
+               journal_mark_dirty(&th, SB_BUFFER_WITH_SB(s));
+               errval = journal_end(&th);
                if (errval) {
                        dput(s->s_root);
                        s->s_root = NULL;
@@ -2220,7 +2209,7 @@ static int reiserfs_write_dquot(struct dquot *dquot)
        depth = reiserfs_write_unlock_nested(dquot->dq_sb);
        ret = dquot_commit(dquot);
        reiserfs_write_lock_nested(dquot->dq_sb, depth);
-       err = journal_end(&th, dquot->dq_sb);
+       err = journal_end(&th);
        if (!ret && err)
                ret = err;
 out:
@@ -2243,7 +2232,7 @@ static int reiserfs_acquire_dquot(struct dquot *dquot)
        depth = reiserfs_write_unlock_nested(dquot->dq_sb);
        ret = dquot_acquire(dquot);
        reiserfs_write_lock_nested(dquot->dq_sb, depth);
-       err = journal_end(&th, dquot->dq_sb);
+       err = journal_end(&th);
        if (!ret && err)
                ret = err;
 out:
@@ -2268,7 +2257,7 @@ static int reiserfs_release_dquot(struct dquot *dquot)
        }
        ret = dquot_release(dquot);
        reiserfs_write_lock(dquot->dq_sb);
-       err = journal_end(&th, dquot->dq_sb);
+       err = journal_end(&th);
        if (!ret && err)
                ret = err;
        reiserfs_write_unlock(dquot->dq_sb);
@@ -2301,7 +2290,7 @@ static int reiserfs_write_info(struct super_block *sb, int type)
        depth = reiserfs_write_unlock_nested(sb);
        ret = dquot_commit_info(sb, type);
        reiserfs_write_lock_nested(sb, depth);
-       err = journal_end(&th, sb);
+       err = journal_end(&th);
        if (!ret && err)
                ret = err;
 out:
@@ -2374,7 +2363,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
                err = journal_begin(&th, sb, 1);
                if (err)
                        goto out;
-               err = journal_end_sync(&th, sb);
+               err = journal_end_sync(&th);
                if (err)
                        goto out;
        }
@@ -2452,8 +2441,7 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
        struct buffer_head tmp_bh, *bh;
 
        if (!current->journal_info) {
-               printk(KERN_WARNING "reiserfs: Quota write (off=%Lu, len=%Lu)"
-                       " cancelled because transaction is not started.\n",
+               printk(KERN_WARNING "reiserfs: Quota write (off=%llu, len=%llu) cancelled because transaction is not started.\n",
                        (unsigned long long)off, (unsigned long long)len);
                return -EIO;
        }
@@ -2481,7 +2469,7 @@ static ssize_t reiserfs_quota_write(struct super_block *sb, int type,
                unlock_buffer(bh);
                reiserfs_write_lock(sb);
                reiserfs_prepare_for_journal(sb, bh, 1);
-               journal_mark_dirty(current->journal_info, sb, bh);
+               journal_mark_dirty(current->journal_info, bh);
                if (!journal_quota)
                        reiserfs_add_ordered_list(inode, bh);
                reiserfs_write_unlock(sb);