Commit 0b8e58a1 authored by Andreas Dilger's avatar Andreas Dilger Committed by Theodore Ts'o

ext4: super.c whitespace cleanup

Cleanup of whitespace and formatting.  Initially driven by confusing indents
for the ext4_{block,inode}_bitmap() et. al. helper routines, but figured I'd
cleanup some other 80-column wrapping and other indenting problems at the
same time.
Signed-off-by: default avatarAndreas Dilger <adilger@sun.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent bfcd3555
...@@ -207,8 +207,7 @@ handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks) ...@@ -207,8 +207,7 @@ handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks)
journal = EXT4_SB(sb)->s_journal; journal = EXT4_SB(sb)->s_journal;
if (journal) { if (journal) {
if (is_journal_aborted(journal)) { if (is_journal_aborted(journal)) {
ext4_abort(sb, __func__, ext4_abort(sb, __func__, "Detected aborted journal");
"Detected aborted journal");
return ERR_PTR(-EROFS); return ERR_PTR(-EROFS);
} }
return jbd2_journal_start(journal, nblocks); return jbd2_journal_start(journal, nblocks);
...@@ -472,7 +471,6 @@ __acquires(bitlock) ...@@ -472,7 +471,6 @@ __acquires(bitlock)
return; return;
} }
void ext4_update_dynamic_rev(struct super_block *sb) void ext4_update_dynamic_rev(struct super_block *sb)
{ {
struct ext4_super_block *es = EXT4_SB(sb)->s_es; struct ext4_super_block *es = EXT4_SB(sb)->s_es;
...@@ -638,7 +636,6 @@ static void ext4_put_super(struct super_block *sb) ...@@ -638,7 +636,6 @@ static void ext4_put_super(struct super_block *sb)
lock_kernel(); lock_kernel();
kfree(sbi->s_blockgroup_lock); kfree(sbi->s_blockgroup_lock);
kfree(sbi); kfree(sbi);
return;
} }
static struct kmem_cache *ext4_inode_cachep; static struct kmem_cache *ext4_inode_cachep;
...@@ -653,6 +650,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) ...@@ -653,6 +650,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
ei = kmem_cache_alloc(ext4_inode_cachep, GFP_NOFS); ei = kmem_cache_alloc(ext4_inode_cachep, GFP_NOFS);
if (!ei) if (!ei)
return NULL; return NULL;
#ifdef CONFIG_EXT4_FS_POSIX_ACL #ifdef CONFIG_EXT4_FS_POSIX_ACL
ei->i_acl = EXT4_ACL_NOT_CACHED; ei->i_acl = EXT4_ACL_NOT_CACHED;
ei->i_default_acl = EXT4_ACL_NOT_CACHED; ei->i_default_acl = EXT4_ACL_NOT_CACHED;
...@@ -673,6 +671,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb) ...@@ -673,6 +671,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
ei->i_allocated_meta_blocks = 0; ei->i_allocated_meta_blocks = 0;
ei->i_delalloc_reserved_flag = 0; ei->i_delalloc_reserved_flag = 0;
spin_lock_init(&(ei->i_block_reservation_lock)); spin_lock_init(&(ei->i_block_reservation_lock));
return &ei->vfs_inode; return &ei->vfs_inode;
} }
...@@ -879,10 +878,10 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) ...@@ -879,10 +878,10 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
seq_puts(seq, ",noauto_da_alloc"); seq_puts(seq, ",noauto_da_alloc");
ext4_show_quota_options(seq, sb); ext4_show_quota_options(seq, sb);
return 0; return 0;
} }
static struct inode *ext4_nfs_get_inode(struct super_block *sb, static struct inode *ext4_nfs_get_inode(struct super_block *sb,
u64 ino, u32 generation) u64 ino, u32 generation)
{ {
...@@ -932,7 +931,8 @@ static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid, ...@@ -932,7 +931,8 @@ static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid,
* which would prevent try_to_free_buffers() from freeing them, we must use * which would prevent try_to_free_buffers() from freeing them, we must use
* jbd2 layer's try_to_free_buffers() function to release them. * jbd2 layer's try_to_free_buffers() function to release them.
*/ */
static int bdev_try_to_free_page(struct super_block *sb, struct page *page, gfp_t wait) static int bdev_try_to_free_page(struct super_block *sb, struct page *page,
gfp_t wait)
{ {
journal_t *journal = EXT4_SB(sb)->s_journal; journal_t *journal = EXT4_SB(sb)->s_journal;
...@@ -1133,8 +1133,9 @@ static ext4_fsblk_t get_sb_block(void **data) ...@@ -1133,8 +1133,9 @@ static ext4_fsblk_t get_sb_block(void **data)
if (!options || strncmp(options, "sb=", 3) != 0) if (!options || strncmp(options, "sb=", 3) != 0)
return 1; /* Default location */ return 1; /* Default location */
options += 3; options += 3;
/*todo: use simple_strtoll with >32bit ext4 */ /* TODO: use simple_strtoll with >32bit ext4 */
sb_block = simple_strtoul(options, &options, 0); sb_block = simple_strtoul(options, &options, 0);
if (*options && *options != ',') { if (*options && *options != ',') {
printk(KERN_ERR "EXT4-fs: Invalid sb specification: %s\n", printk(KERN_ERR "EXT4-fs: Invalid sb specification: %s\n",
...@@ -1144,6 +1145,7 @@ static ext4_fsblk_t get_sb_block(void **data) ...@@ -1144,6 +1145,7 @@ static ext4_fsblk_t get_sb_block(void **data)
if (*options == ',') if (*options == ',')
options++; options++;
*data = (void *) options; *data = (void *) options;
return sb_block; return sb_block;
} }
...@@ -1810,7 +1812,7 @@ static int ext4_check_descriptors(struct super_block *sb) ...@@ -1810,7 +1812,7 @@ static int ext4_check_descriptors(struct super_block *sb)
} }
ext4_free_blocks_count_set(sbi->s_es, ext4_count_free_blocks(sb)); ext4_free_blocks_count_set(sbi->s_es, ext4_count_free_blocks(sb));
sbi->s_es->s_free_inodes_count = cpu_to_le32(ext4_count_free_inodes(sb)); sbi->s_es->s_free_inodes_count =cpu_to_le32(ext4_count_free_inodes(sb));
return 1; return 1;
} }
...@@ -1926,6 +1928,7 @@ static void ext4_orphan_cleanup(struct super_block *sb, ...@@ -1926,6 +1928,7 @@ static void ext4_orphan_cleanup(struct super_block *sb,
#endif #endif
sb->s_flags = s_flags; /* Restore MS_RDONLY status */ sb->s_flags = s_flags; /* Restore MS_RDONLY status */
} }
/* /*
* Maximal extent format file size. * Maximal extent format file size.
* Resulting logical blkno at s_maxbytes must fit in our on-disk * Resulting logical blkno at s_maxbytes must fit in our on-disk
...@@ -1976,19 +1979,19 @@ static loff_t ext4_max_bitmap_size(int bits, int has_huge_files) ...@@ -1976,19 +1979,19 @@ static loff_t ext4_max_bitmap_size(int bits, int has_huge_files)
loff_t res = EXT4_NDIR_BLOCKS; loff_t res = EXT4_NDIR_BLOCKS;
int meta_blocks; int meta_blocks;
loff_t upper_limit; loff_t upper_limit;
/* This is calculated to be the largest file size for a /* This is calculated to be the largest file size for a dense, block
* dense, bitmapped file such that the total number of * mapped file such that the file's total number of 512-byte sectors,
* sectors in the file, including data and all indirect blocks, * including data and all indirect blocks, does not exceed (2^48 - 1).
* does not exceed 2^48 -1 *
* __u32 i_blocks_lo and _u16 i_blocks_high representing the * __u32 i_blocks_lo and _u16 i_blocks_high represent the total
* total number of 512 bytes blocks of the file * number of 512-byte sectors of the file.
*/ */
if (!has_huge_files || sizeof(blkcnt_t) < sizeof(u64)) { if (!has_huge_files || sizeof(blkcnt_t) < sizeof(u64)) {
/* /*
* !has_huge_files or CONFIG_LBD is not enabled * !has_huge_files or CONFIG_LBD not enabled implies that
* implies the inode i_block represent total blocks in * the inode i_block field represents total file blocks in
* 512 bytes 32 == size of vfs inode i_blocks * 8 * 2^32 512-byte sectors == size of vfs inode i_blocks * 8
*/ */
upper_limit = (1LL << 32) - 1; upper_limit = (1LL << 32) - 1;
...@@ -2044,6 +2047,7 @@ static ext4_fsblk_t descriptor_loc(struct super_block *sb, ...@@ -2044,6 +2047,7 @@ static ext4_fsblk_t descriptor_loc(struct super_block *sb,
bg = sbi->s_desc_per_block * nr; bg = sbi->s_desc_per_block * nr;
if (ext4_bg_has_super(sb, bg)) if (ext4_bg_has_super(sb, bg))
has_super = 1; has_super = 1;
return (has_super + ext4_group_first_block_no(sb, bg)); return (has_super + ext4_group_first_block_no(sb, bg));
} }
...@@ -2253,7 +2257,6 @@ static struct kobj_type ext4_ktype = { ...@@ -2253,7 +2257,6 @@ static struct kobj_type ext4_ktype = {
static int ext4_fill_super(struct super_block *sb, void *data, int silent) static int ext4_fill_super(struct super_block *sb, void *data, int silent)
__releases(kernel_lock) __releases(kernel_lock)
__acquires(kernel_lock) __acquires(kernel_lock)
{ {
struct buffer_head *bh; struct buffer_head *bh;
struct ext4_super_block *es = NULL; struct ext4_super_block *es = NULL;
...@@ -2379,7 +2382,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -2379,7 +2382,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
*/ */
set_opt(sbi->s_mount_opt, DELALLOC); set_opt(sbi->s_mount_opt, DELALLOC);
if (!parse_options((char *) data, sb, &journal_devnum, if (!parse_options((char *) data, sb, &journal_devnum,
&journal_ioprio, NULL, 0)) &journal_ioprio, NULL, 0))
goto failed_mount; goto failed_mount;
...@@ -2442,7 +2444,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -2442,7 +2444,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
} }
if (sb->s_blocksize != blocksize) { if (sb->s_blocksize != blocksize) {
/* Validate the filesystem blocksize */ /* Validate the filesystem blocksize */
if (!sb_set_blocksize(sb, blocksize)) { if (!sb_set_blocksize(sb, blocksize)) {
printk(KERN_ERR "EXT4-fs: bad block size %d.\n", printk(KERN_ERR "EXT4-fs: bad block size %d.\n",
...@@ -2489,6 +2490,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -2489,6 +2490,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE)
sb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2); sb->s_time_gran = 1 << (EXT4_EPOCH_BITS - 2);
} }
sbi->s_desc_size = le16_to_cpu(es->s_desc_size); sbi->s_desc_size = le16_to_cpu(es->s_desc_size);
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) { if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) {
if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT || if (sbi->s_desc_size < EXT4_MIN_DESC_SIZE_64BIT ||
...@@ -2501,10 +2503,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -2501,10 +2503,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
} }
} else } else
sbi->s_desc_size = EXT4_MIN_DESC_SIZE; sbi->s_desc_size = EXT4_MIN_DESC_SIZE;
sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group); sbi->s_blocks_per_group = le32_to_cpu(es->s_blocks_per_group);
sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group); sbi->s_inodes_per_group = le32_to_cpu(es->s_inodes_per_group);
if (EXT4_INODE_SIZE(sb) == 0 || EXT4_INODES_PER_GROUP(sb) == 0) if (EXT4_INODE_SIZE(sb) == 0 || EXT4_INODES_PER_GROUP(sb) == 0)
goto cantfind_ext4; goto cantfind_ext4;
sbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb); sbi->s_inodes_per_block = blocksize / EXT4_INODE_SIZE(sb);
if (sbi->s_inodes_per_block == 0) if (sbi->s_inodes_per_block == 0)
goto cantfind_ext4; goto cantfind_ext4;
...@@ -2515,6 +2519,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) ...@@ -2515,6 +2519,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
sbi->s_mount_state = le16_to_cpu(es->s_state); sbi->s_mount_state = le16_to_cpu(es->s_state);
sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb)); sbi->s_addr_per_block_bits = ilog2(EXT4_ADDR_PER_BLOCK(sb));
sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb)); sbi->s_desc_per_block_bits = ilog2(EXT4_DESC_PER_BLOCK(sb));
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]); sbi->s_hash_seed[i] = le32_to_cpu(es->s_hash_seed[i]);
sbi->s_def_hash_version = es->s_def_hash_version; sbi->s_def_hash_version = es->s_def_hash_version;
...@@ -3082,6 +3087,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb, ...@@ -3082,6 +3087,7 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
EXT4_SB(sb)->journal_bdev = bdev; EXT4_SB(sb)->journal_bdev = bdev;
ext4_init_journal_params(sb, journal); ext4_init_journal_params(sb, journal);
return journal; return journal;
out_journal: out_journal:
jbd2_journal_destroy(journal); jbd2_journal_destroy(journal);
out_bdev: out_bdev:
...@@ -3116,7 +3122,6 @@ static int ext4_load_journal(struct super_block *sb, ...@@ -3116,7 +3122,6 @@ static int ext4_load_journal(struct super_block *sb,
* crash? For recovery, we need to check in advance whether we * crash? For recovery, we need to check in advance whether we
* can get read-write access to the device. * can get read-write access to the device.
*/ */
if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) { if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER)) {
if (sb->s_flags & MS_RDONLY) { if (sb->s_flags & MS_RDONLY) {
printk(KERN_INFO "EXT4-fs: INFO: recovery " printk(KERN_INFO "EXT4-fs: INFO: recovery "
...@@ -3234,7 +3239,6 @@ static int ext4_commit_super(struct super_block *sb, int sync) ...@@ -3234,7 +3239,6 @@ static int ext4_commit_super(struct super_block *sb, int sync)
return error; return error;
} }
/* /*
* Have we just finished recovery? If so, and if we are mounting (or * Have we just finished recovery? If so, and if we are mounting (or
* remounting) the filesystem readonly, then we will end up with a * remounting) the filesystem readonly, then we will end up with a
...@@ -3485,8 +3489,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) ...@@ -3485,8 +3489,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
/* /*
* Make sure the group descriptor checksums * Make sure the group descriptor checksums
* are sane. If they aren't, refuse to * are sane. If they aren't, refuse to remount r/w.
* remount r/w.
*/ */
for (g = 0; g < sbi->s_groups_count; g++) { for (g = 0; g < sbi->s_groups_count; g++) {
struct ext4_group_desc *gdp = struct ext4_group_desc *gdp =
...@@ -3545,6 +3548,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) ...@@ -3545,6 +3548,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
kfree(old_opts.s_qf_names[i]); kfree(old_opts.s_qf_names[i]);
#endif #endif
return 0; return 0;
restore_opts: restore_opts:
sb->s_flags = old_sb_flags; sb->s_flags = old_sb_flags;
sbi->s_mount_opt = old_opts.s_mount_opt; sbi->s_mount_opt = old_opts.s_mount_opt;
...@@ -3628,11 +3632,12 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -3628,11 +3632,12 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
le64_to_cpup((void *)es->s_uuid + sizeof(u64)); le64_to_cpup((void *)es->s_uuid + sizeof(u64));
buf->f_fsid.val[0] = fsid & 0xFFFFFFFFUL; buf->f_fsid.val[0] = fsid & 0xFFFFFFFFUL;
buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL; buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL;
return 0; return 0;
} }
/* Helper function for writing quotas on sync - we need to start transaction before quota file /* Helper function for writing quotas on sync - we need to start transaction
* is locked for write. Otherwise the are possible deadlocks: * before quota file is locked for write. Otherwise the are possible deadlocks:
* Process 1 Process 2 * Process 1 Process 2
* ext4_create() quota_sync() * ext4_create() quota_sync()
* jbd2_journal_start() write_dquot() * jbd2_journal_start() write_dquot()
...@@ -3907,10 +3912,10 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type, ...@@ -3907,10 +3912,10 @@ static ssize_t ext4_quota_write(struct super_block *sb, int type,
#endif #endif
static int ext4_get_sb(struct file_system_type *fs_type, static int ext4_get_sb(struct file_system_type *fs_type, int flags,
int flags, const char *dev_name, void *data, struct vfsmount *mnt) const char *dev_name, void *data, struct vfsmount *mnt)
{ {
return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super, mnt); return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt);
} }
static struct file_system_type ext4_fs_type = { static struct file_system_type ext4_fs_type = {
...@@ -3922,14 +3927,14 @@ static struct file_system_type ext4_fs_type = { ...@@ -3922,14 +3927,14 @@ static struct file_system_type ext4_fs_type = {
}; };
#ifdef CONFIG_EXT4DEV_COMPAT #ifdef CONFIG_EXT4DEV_COMPAT
static int ext4dev_get_sb(struct file_system_type *fs_type, static int ext4dev_get_sb(struct file_system_type *fs_type, int flags,
int flags, const char *dev_name, void *data, struct vfsmount *mnt) const char *dev_name, void *data,struct vfsmount *mnt)
{ {
printk(KERN_WARNING "EXT4-fs: Update your userspace programs " printk(KERN_WARNING "EXT4-fs: Update your userspace programs "
"to mount using ext4\n"); "to mount using ext4\n");
printk(KERN_WARNING "EXT4-fs: ext4dev backwards compatibility " printk(KERN_WARNING "EXT4-fs: ext4dev backwards compatibility "
"will go away by 2.6.31\n"); "will go away by 2.6.31\n");
return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super, mnt); return get_sb_bdev(fs_type, flags, dev_name, data, ext4_fill_super,mnt);
} }
static struct file_system_type ext4dev_fs_type = { static struct file_system_type ext4dev_fs_type = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment