提交 2b2d6d01 编写于 作者: T Theodore Ts'o

ext4: Cleanup whitespace and other miscellaneous style issues

Signed-off-by: N"Theodore Ts'o" <tytso@mit.edu>
上级 ec05e868
...@@ -40,34 +40,35 @@ ext4_acl_from_disk(const void *value, size_t size) ...@@ -40,34 +40,35 @@ ext4_acl_from_disk(const void *value, size_t size)
acl = posix_acl_alloc(count, GFP_NOFS); acl = posix_acl_alloc(count, GFP_NOFS);
if (!acl) if (!acl)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
for (n=0; n < count; n++) { for (n = 0; n < count; n++) {
ext4_acl_entry *entry = ext4_acl_entry *entry =
(ext4_acl_entry *)value; (ext4_acl_entry *)value;
if ((char *)value + sizeof(ext4_acl_entry_short) > end) if ((char *)value + sizeof(ext4_acl_entry_short) > end)
goto fail; goto fail;
acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag); acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag);
acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm); acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm);
switch(acl->a_entries[n].e_tag) {
case ACL_USER_OBJ: switch (acl->a_entries[n].e_tag) {
case ACL_GROUP_OBJ: case ACL_USER_OBJ:
case ACL_MASK: case ACL_GROUP_OBJ:
case ACL_OTHER: case ACL_MASK:
value = (char *)value + case ACL_OTHER:
sizeof(ext4_acl_entry_short); value = (char *)value +
acl->a_entries[n].e_id = ACL_UNDEFINED_ID; sizeof(ext4_acl_entry_short);
break; acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
break;
case ACL_USER:
case ACL_GROUP: case ACL_USER:
value = (char *)value + sizeof(ext4_acl_entry); case ACL_GROUP:
if ((char *)value > end) value = (char *)value + sizeof(ext4_acl_entry);
goto fail; if ((char *)value > end)
acl->a_entries[n].e_id =
le32_to_cpu(entry->e_id);
break;
default:
goto fail; goto fail;
acl->a_entries[n].e_id =
le32_to_cpu(entry->e_id);
break;
default:
goto fail;
} }
} }
if (value != end) if (value != end)
...@@ -96,27 +97,26 @@ ext4_acl_to_disk(const struct posix_acl *acl, size_t *size) ...@@ -96,27 +97,26 @@ ext4_acl_to_disk(const struct posix_acl *acl, size_t *size)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
ext_acl->a_version = cpu_to_le32(EXT4_ACL_VERSION); ext_acl->a_version = cpu_to_le32(EXT4_ACL_VERSION);
e = (char *)ext_acl + sizeof(ext4_acl_header); e = (char *)ext_acl + sizeof(ext4_acl_header);
for (n=0; n < acl->a_count; n++) { for (n = 0; n < acl->a_count; n++) {
ext4_acl_entry *entry = (ext4_acl_entry *)e; ext4_acl_entry *entry = (ext4_acl_entry *)e;
entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag); entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag);
entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm); entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm);
switch(acl->a_entries[n].e_tag) { switch (acl->a_entries[n].e_tag) {
case ACL_USER: case ACL_USER:
case ACL_GROUP: case ACL_GROUP:
entry->e_id = entry->e_id = cpu_to_le32(acl->a_entries[n].e_id);
cpu_to_le32(acl->a_entries[n].e_id); e += sizeof(ext4_acl_entry);
e += sizeof(ext4_acl_entry); break;
break;
case ACL_USER_OBJ:
case ACL_USER_OBJ: case ACL_GROUP_OBJ:
case ACL_GROUP_OBJ: case ACL_MASK:
case ACL_MASK: case ACL_OTHER:
case ACL_OTHER: e += sizeof(ext4_acl_entry_short);
e += sizeof(ext4_acl_entry_short); break;
break;
default:
default: goto fail;
goto fail;
} }
} }
return (char *)ext_acl; return (char *)ext_acl;
...@@ -167,23 +167,23 @@ ext4_get_acl(struct inode *inode, int type) ...@@ -167,23 +167,23 @@ ext4_get_acl(struct inode *inode, int type)
if (!test_opt(inode->i_sb, POSIX_ACL)) if (!test_opt(inode->i_sb, POSIX_ACL))
return NULL; return NULL;
switch(type) { switch (type) {
case ACL_TYPE_ACCESS: case ACL_TYPE_ACCESS:
acl = ext4_iget_acl(inode, &ei->i_acl); acl = ext4_iget_acl(inode, &ei->i_acl);
if (acl != EXT4_ACL_NOT_CACHED) if (acl != EXT4_ACL_NOT_CACHED)
return acl; return acl;
name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS; name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
break; break;
case ACL_TYPE_DEFAULT: case ACL_TYPE_DEFAULT:
acl = ext4_iget_acl(inode, &ei->i_default_acl); acl = ext4_iget_acl(inode, &ei->i_default_acl);
if (acl != EXT4_ACL_NOT_CACHED) if (acl != EXT4_ACL_NOT_CACHED)
return acl; return acl;
name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT; name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
break; break;
default: default:
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
retval = ext4_xattr_get(inode, name_index, "", NULL, 0); retval = ext4_xattr_get(inode, name_index, "", NULL, 0);
if (retval > 0) { if (retval > 0) {
...@@ -201,14 +201,14 @@ ext4_get_acl(struct inode *inode, int type) ...@@ -201,14 +201,14 @@ ext4_get_acl(struct inode *inode, int type)
kfree(value); kfree(value);
if (!IS_ERR(acl)) { if (!IS_ERR(acl)) {
switch(type) { switch (type) {
case ACL_TYPE_ACCESS: case ACL_TYPE_ACCESS:
ext4_iset_acl(inode, &ei->i_acl, acl); ext4_iset_acl(inode, &ei->i_acl, acl);
break; break;
case ACL_TYPE_DEFAULT: case ACL_TYPE_DEFAULT:
ext4_iset_acl(inode, &ei->i_default_acl, acl); ext4_iset_acl(inode, &ei->i_default_acl, acl);
break; break;
} }
} }
return acl; return acl;
...@@ -232,31 +232,31 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type, ...@@ -232,31 +232,31 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
if (S_ISLNK(inode->i_mode)) if (S_ISLNK(inode->i_mode))
return -EOPNOTSUPP; return -EOPNOTSUPP;
switch(type) { switch (type) {
case ACL_TYPE_ACCESS: case ACL_TYPE_ACCESS:
name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS; name_index = EXT4_XATTR_INDEX_POSIX_ACL_ACCESS;
if (acl) { if (acl) {
mode_t mode = inode->i_mode; mode_t mode = inode->i_mode;
error = posix_acl_equiv_mode(acl, &mode); error = posix_acl_equiv_mode(acl, &mode);
if (error < 0) if (error < 0)
return error; return error;
else { else {
inode->i_mode = mode; inode->i_mode = mode;
ext4_mark_inode_dirty(handle, inode); ext4_mark_inode_dirty(handle, inode);
if (error == 0) if (error == 0)
acl = NULL; acl = NULL;
}
} }
break; }
break;
case ACL_TYPE_DEFAULT: case ACL_TYPE_DEFAULT:
name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT; name_index = EXT4_XATTR_INDEX_POSIX_ACL_DEFAULT;
if (!S_ISDIR(inode->i_mode)) if (!S_ISDIR(inode->i_mode))
return acl ? -EACCES : 0; return acl ? -EACCES : 0;
break; break;
default: default:
return -EINVAL; return -EINVAL;
} }
if (acl) { if (acl) {
value = ext4_acl_to_disk(acl, &size); value = ext4_acl_to_disk(acl, &size);
...@@ -269,14 +269,14 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type, ...@@ -269,14 +269,14 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
kfree(value); kfree(value);
if (!error) { if (!error) {
switch(type) { switch (type) {
case ACL_TYPE_ACCESS: case ACL_TYPE_ACCESS:
ext4_iset_acl(inode, &ei->i_acl, acl); ext4_iset_acl(inode, &ei->i_acl, acl);
break; break;
case ACL_TYPE_DEFAULT: case ACL_TYPE_DEFAULT:
ext4_iset_acl(inode, &ei->i_default_acl, acl); ext4_iset_acl(inode, &ei->i_default_acl, acl);
break; break;
} }
} }
return error; return error;
......
...@@ -1441,7 +1441,7 @@ unsigned int ext4_ext_check_overlap(struct inode *inode, ...@@ -1441,7 +1441,7 @@ unsigned int ext4_ext_check_overlap(struct inode *inode,
/* /*
* get the next allocated block if the extent in the path * get the next allocated block if the extent in the path
* is before the requested block(s) * is before the requested block(s)
*/ */
if (b2 < b1) { if (b2 < b1) {
b2 = ext4_ext_next_allocated_block(path); b2 = ext4_ext_next_allocated_block(path);
......
...@@ -1054,10 +1054,9 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used) ...@@ -1054,10 +1054,9 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
/* /*
* The ext4_get_blocks_wrap() function try to look up the requested blocks,
* and returns if the blocks are already mapped.
* *
*
* ext4_ext4 get_block() wrapper function
* It will do a look up first, and returns if the blocks already mapped.
* Otherwise it takes the write lock of the i_data_sem and allocate blocks * Otherwise it takes the write lock of the i_data_sem and allocate blocks
* and store the allocated blocks in the result buffer head and mark it * and store the allocated blocks in the result buffer head and mark it
* mapped. * mapped.
......
...@@ -73,7 +73,7 @@ static int verify_group_input(struct super_block *sb, ...@@ -73,7 +73,7 @@ static int verify_group_input(struct super_block *sb,
"Inode bitmap not in group (block %llu)", "Inode bitmap not in group (block %llu)",
(unsigned long long)input->inode_bitmap); (unsigned long long)input->inode_bitmap);
else if (outside(input->inode_table, start, end) || else if (outside(input->inode_table, start, end) ||
outside(itend - 1, start, end)) outside(itend - 1, start, end))
ext4_warning(sb, __func__, ext4_warning(sb, __func__,
"Inode table not in group (blocks %llu-%llu)", "Inode table not in group (blocks %llu-%llu)",
(unsigned long long)input->inode_table, itend - 1); (unsigned long long)input->inode_table, itend - 1);
...@@ -104,7 +104,7 @@ static int verify_group_input(struct super_block *sb, ...@@ -104,7 +104,7 @@ static int verify_group_input(struct super_block *sb,
(unsigned long long)input->inode_bitmap, (unsigned long long)input->inode_bitmap,
start, metaend - 1); start, metaend - 1);
else if (inside(input->inode_table, start, metaend) || else if (inside(input->inode_table, start, metaend) ||
inside(itend - 1, start, metaend)) inside(itend - 1, start, metaend))
ext4_warning(sb, __func__, ext4_warning(sb, __func__,
"Inode table (%llu-%llu) overlaps" "Inode table (%llu-%llu) overlaps"
"GDT table (%llu-%llu)", "GDT table (%llu-%llu)",
...@@ -158,9 +158,9 @@ static int extend_or_restart_transaction(handle_t *handle, int thresh, ...@@ -158,9 +158,9 @@ static int extend_or_restart_transaction(handle_t *handle, int thresh,
if (err) { if (err) {
if ((err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA))) if ((err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA)))
return err; return err;
if ((err = ext4_journal_get_write_access(handle, bh))) if ((err = ext4_journal_get_write_access(handle, bh)))
return err; return err;
} }
return 0; return 0;
} }
...@@ -416,11 +416,11 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, ...@@ -416,11 +416,11 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
"EXT4-fs: ext4_add_new_gdb: adding group block %lu\n", "EXT4-fs: ext4_add_new_gdb: adding group block %lu\n",
gdb_num); gdb_num);
/* /*
* If we are not using the primary superblock/GDT copy don't resize, * If we are not using the primary superblock/GDT copy don't resize,
* because the user tools have no way of handling this. Probably a * because the user tools have no way of handling this. Probably a
* bad time to do it anyways. * bad time to do it anyways.
*/ */
if (EXT4_SB(sb)->s_sbh->b_blocknr != if (EXT4_SB(sb)->s_sbh->b_blocknr !=
le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) { le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) {
ext4_warning(sb, __func__, ext4_warning(sb, __func__,
...@@ -507,14 +507,14 @@ static int add_new_gdb(handle_t *handle, struct inode *inode, ...@@ -507,14 +507,14 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
return 0; return 0;
exit_inode: exit_inode:
//ext4_journal_release_buffer(handle, iloc.bh); /* ext4_journal_release_buffer(handle, iloc.bh); */
brelse(iloc.bh); brelse(iloc.bh);
exit_dindj: exit_dindj:
//ext4_journal_release_buffer(handle, dind); /* ext4_journal_release_buffer(handle, dind); */
exit_primary: exit_primary:
//ext4_journal_release_buffer(handle, *primary); /* ext4_journal_release_buffer(handle, *primary); */
exit_sbh: exit_sbh:
//ext4_journal_release_buffer(handle, *primary); /* ext4_journal_release_buffer(handle, *primary); */
exit_dind: exit_dind:
brelse(dind); brelse(dind);
exit_bh: exit_bh:
...@@ -818,12 +818,12 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) ...@@ -818,12 +818,12 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
if ((err = ext4_journal_get_write_access(handle, sbi->s_sbh))) if ((err = ext4_journal_get_write_access(handle, sbi->s_sbh)))
goto exit_journal; goto exit_journal;
/* /*
* We will only either add reserved group blocks to a backup group * We will only either add reserved group blocks to a backup group
* or remove reserved blocks for the first group in a new group block. * or remove reserved blocks for the first group in a new group block.
* Doing both would be mean more complex code, and sane people don't * Doing both would be mean more complex code, and sane people don't
* use non-sparse filesystems anymore. This is already checked above. * use non-sparse filesystems anymore. This is already checked above.
*/ */
if (gdb_off) { if (gdb_off) {
primary = sbi->s_group_desc[gdb_num]; primary = sbi->s_group_desc[gdb_num];
if ((err = ext4_journal_get_write_access(handle, primary))) if ((err = ext4_journal_get_write_access(handle, primary)))
...@@ -835,24 +835,24 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) ...@@ -835,24 +835,24 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
} else if ((err = add_new_gdb(handle, inode, input, &primary))) } else if ((err = add_new_gdb(handle, inode, input, &primary)))
goto exit_journal; goto exit_journal;
/* /*
* OK, now we've set up the new group. Time to make it active. * OK, now we've set up the new group. Time to make it active.
* *
* Current kernels don't lock all allocations via lock_super(), * Current kernels don't lock all allocations via lock_super(),
* so we have to be safe wrt. concurrent accesses the group * so we have to be safe wrt. concurrent accesses the group
* data. So we need to be careful to set all of the relevant * data. So we need to be careful to set all of the relevant
* group descriptor data etc. *before* we enable the group. * group descriptor data etc. *before* we enable the group.
* *
* The key field here is sbi->s_groups_count: as long as * The key field here is sbi->s_groups_count: as long as
* that retains its old value, nobody is going to access the new * that retains its old value, nobody is going to access the new
* group. * group.
* *
* So first we update all the descriptor metadata for the new * So first we update all the descriptor metadata for the new
* group; then we update the total disk blocks count; then we * group; then we update the total disk blocks count; then we
* update the groups count to enable the group; then finally we * update the groups count to enable the group; then finally we
* update the free space counts so that the system can start * update the free space counts so that the system can start
* using the new disk blocks. * using the new disk blocks.
*/ */
/* Update group descriptor block for new group */ /* Update group descriptor block for new group */
gdp = (struct ext4_group_desc *)((char *)primary->b_data + gdp = (struct ext4_group_desc *)((char *)primary->b_data +
...@@ -946,7 +946,8 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) ...@@ -946,7 +946,8 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
return err; return err;
} /* ext4_group_add */ } /* ext4_group_add */
/* Extend the filesystem to the new number of blocks specified. This entry /*
* Extend the filesystem to the new number of blocks specified. This entry
* point is only used to extend the current filesystem to the end of the last * point is only used to extend the current filesystem to the end of the last
* existing group. It can be accessed via ioctl, or by "remount,resize=<size>" * existing group. It can be accessed via ioctl, or by "remount,resize=<size>"
* for emergencies (because it has no dependencies on reserved blocks). * for emergencies (because it has no dependencies on reserved blocks).
...@@ -1024,7 +1025,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es, ...@@ -1024,7 +1025,7 @@ int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es,
o_blocks_count + add, add); o_blocks_count + add, add);
/* See if the device is actually as big as what was requested */ /* See if the device is actually as big as what was requested */
bh = sb_bread(sb, o_blocks_count + add -1); bh = sb_bread(sb, o_blocks_count + add - 1);
if (!bh) { if (!bh) {
ext4_warning(sb, __func__, ext4_warning(sb, __func__,
"can't read last block, resize aborted"); "can't read last block, resize aborted");
......
...@@ -49,20 +49,19 @@ static int ext4_load_journal(struct super_block *, struct ext4_super_block *, ...@@ -49,20 +49,19 @@ static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
unsigned long journal_devnum); unsigned long journal_devnum);
static int ext4_create_journal(struct super_block *, struct ext4_super_block *, static int ext4_create_journal(struct super_block *, struct ext4_super_block *,
unsigned int); unsigned int);
static void ext4_commit_super (struct super_block * sb, static void ext4_commit_super(struct super_block *sb,
struct ext4_super_block * es, struct ext4_super_block *es, int sync);
int sync); static void ext4_mark_recovery_complete(struct super_block *sb,
static void ext4_mark_recovery_complete(struct super_block * sb, struct ext4_super_block *es);
struct ext4_super_block * es); static void ext4_clear_journal_err(struct super_block *sb,
static void ext4_clear_journal_err(struct super_block * sb, struct ext4_super_block *es);
struct ext4_super_block * es);
static int ext4_sync_fs(struct super_block *sb, int wait); static int ext4_sync_fs(struct super_block *sb, int wait);
static const char *ext4_decode_error(struct super_block * sb, int errno, static const char *ext4_decode_error(struct super_block *sb, int errno,
char nbuf[16]); char nbuf[16]);
static int ext4_remount (struct super_block * sb, int * flags, char * data); static int ext4_remount(struct super_block *sb, int *flags, char *data);
static int ext4_statfs (struct dentry * dentry, struct kstatfs * buf); static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf);
static void ext4_unlockfs(struct super_block *sb); static void ext4_unlockfs(struct super_block *sb);
static void ext4_write_super (struct super_block * sb); static void ext4_write_super(struct super_block *sb);
static void ext4_write_super_lockfs(struct super_block *sb); static void ext4_write_super_lockfs(struct super_block *sb);
...@@ -211,15 +210,15 @@ static void ext4_handle_error(struct super_block *sb) ...@@ -211,15 +210,15 @@ static void ext4_handle_error(struct super_block *sb)
if (sb->s_flags & MS_RDONLY) if (sb->s_flags & MS_RDONLY)
return; return;
if (!test_opt (sb, ERRORS_CONT)) { if (!test_opt(sb, ERRORS_CONT)) {
journal_t *journal = EXT4_SB(sb)->s_journal; journal_t *journal = EXT4_SB(sb)->s_journal;
EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT; EXT4_SB(sb)->s_mount_opt |= EXT4_MOUNT_ABORT;
if (journal) if (journal)
jbd2_journal_abort(journal, -EIO); jbd2_journal_abort(journal, -EIO);
} }
if (test_opt (sb, ERRORS_RO)) { if (test_opt(sb, ERRORS_RO)) {
printk (KERN_CRIT "Remounting filesystem read-only\n"); printk(KERN_CRIT "Remounting filesystem read-only\n");
sb->s_flags |= MS_RDONLY; sb->s_flags |= MS_RDONLY;
} }
ext4_commit_super(sb, es, 1); ext4_commit_super(sb, es, 1);
...@@ -228,13 +227,13 @@ static void ext4_handle_error(struct super_block *sb) ...@@ -228,13 +227,13 @@ static void ext4_handle_error(struct super_block *sb)
sb->s_id); sb->s_id);
} }
void ext4_error (struct super_block * sb, const char * function, void ext4_error(struct super_block *sb, const char *function,
const char * fmt, ...) const char *fmt, ...)
{ {
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
printk(KERN_CRIT "EXT4-fs error (device %s): %s: ",sb->s_id, function); printk(KERN_CRIT "EXT4-fs error (device %s): %s: ", sb->s_id, function);
vprintk(fmt, args); vprintk(fmt, args);
printk("\n"); printk("\n");
va_end(args); va_end(args);
...@@ -242,7 +241,7 @@ void ext4_error (struct super_block * sb, const char * function, ...@@ -242,7 +241,7 @@ void ext4_error (struct super_block * sb, const char * function,
ext4_handle_error(sb); ext4_handle_error(sb);
} }
static const char *ext4_decode_error(struct super_block * sb, int errno, static const char *ext4_decode_error(struct super_block *sb, int errno,
char nbuf[16]) char nbuf[16])
{ {
char *errstr = NULL; char *errstr = NULL;
...@@ -278,8 +277,7 @@ static const char *ext4_decode_error(struct super_block * sb, int errno, ...@@ -278,8 +277,7 @@ static const char *ext4_decode_error(struct super_block * sb, int errno,
/* __ext4_std_error decodes expected errors from journaling functions /* __ext4_std_error decodes expected errors from journaling functions
* automatically and invokes the appropriate error response. */ * automatically and invokes the appropriate error response. */
void __ext4_std_error (struct super_block * sb, const char * function, void __ext4_std_error(struct super_block *sb, const char *function, int errno)
int errno)
{ {
char nbuf[16]; char nbuf[16];
const char *errstr; const char *errstr;
...@@ -292,8 +290,8 @@ void __ext4_std_error (struct super_block * sb, const char * function, ...@@ -292,8 +290,8 @@ void __ext4_std_error (struct super_block * sb, const char * function,
return; return;
errstr = ext4_decode_error(sb, errno, nbuf); errstr = ext4_decode_error(sb, errno, nbuf);
printk (KERN_CRIT "EXT4-fs error (device %s) in %s: %s\n", printk(KERN_CRIT "EXT4-fs error (device %s) in %s: %s\n",
sb->s_id, function, errstr); sb->s_id, function, errstr);
ext4_handle_error(sb); ext4_handle_error(sb);
} }
...@@ -308,15 +306,15 @@ void __ext4_std_error (struct super_block * sb, const char * function, ...@@ -308,15 +306,15 @@ void __ext4_std_error (struct super_block * sb, const char * function,
* case we take the easy way out and panic immediately. * case we take the easy way out and panic immediately.
*/ */
void ext4_abort (struct super_block * sb, const char * function, void ext4_abort(struct super_block *sb, const char *function,
const char * fmt, ...) const char *fmt, ...)
{ {
va_list args; va_list args;
printk (KERN_CRIT "ext4_abort called.\n"); printk(KERN_CRIT "ext4_abort called.\n");
va_start(args, fmt); va_start(args, fmt);
printk(KERN_CRIT "EXT4-fs error (device %s): %s: ",sb->s_id, function); printk(KERN_CRIT "EXT4-fs error (device %s): %s: ", sb->s_id, function);
vprintk(fmt, args); vprintk(fmt, args);
printk("\n"); printk("\n");
va_end(args); va_end(args);
...@@ -334,8 +332,8 @@ void ext4_abort (struct super_block * sb, const char * function, ...@@ -334,8 +332,8 @@ void ext4_abort (struct super_block * sb, const char * function,
jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO);
} }
void ext4_warning (struct super_block * sb, const char * function, void ext4_warning(struct super_block *sb, const char *function,
const char * fmt, ...) const char *fmt, ...)
{ {
va_list args; va_list args;
...@@ -496,7 +494,7 @@ static void dump_orphan_list(struct super_block *sb, struct ext4_sb_info *sbi) ...@@ -496,7 +494,7 @@ static void dump_orphan_list(struct super_block *sb, struct ext4_sb_info *sbi)
} }
} }
static void ext4_put_super (struct super_block * sb) static void ext4_put_super(struct super_block *sb)
{ {
struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_sb_info *sbi = EXT4_SB(sb);
struct ext4_super_block *es = sbi->s_es; struct ext4_super_block *es = sbi->s_es;
...@@ -647,7 +645,8 @@ static void ext4_clear_inode(struct inode *inode) ...@@ -647,7 +645,8 @@ static void ext4_clear_inode(struct inode *inode)
&EXT4_I(inode)->jinode); &EXT4_I(inode)->jinode);
} }
static inline void ext4_show_quota_options(struct seq_file *seq, struct super_block *sb) static inline void ext4_show_quota_options(struct seq_file *seq,
struct super_block *sb)
{ {
#if defined(CONFIG_QUOTA) #if defined(CONFIG_QUOTA)
struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_sb_info *sbi = EXT4_SB(sb);
...@@ -822,8 +821,8 @@ static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid, ...@@ -822,8 +821,8 @@ static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid,
} }
#ifdef CONFIG_QUOTA #ifdef CONFIG_QUOTA
#define QTYPE2NAME(t) ((t)==USRQUOTA?"user":"group") #define QTYPE2NAME(t) ((t) == USRQUOTA?"user":"group")
#define QTYPE2MOPT(on, t) ((t)==USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA)) #define QTYPE2MOPT(on, t) ((t) == USRQUOTA?((on)##USRJQUOTA):((on)##GRPJQUOTA))
static int ext4_dquot_initialize(struct inode *inode, int type); static int ext4_dquot_initialize(struct inode *inode, int type);
static int ext4_dquot_drop(struct inode *inode); static int ext4_dquot_drop(struct inode *inode);
...@@ -991,12 +990,12 @@ static ext4_fsblk_t get_sb_block(void **data) ...@@ -991,12 +990,12 @@ static ext4_fsblk_t get_sb_block(void **data)
return sb_block; return sb_block;
} }
static int parse_options (char *options, struct super_block *sb, static int parse_options(char *options, struct super_block *sb,
unsigned int *inum, unsigned long *journal_devnum, unsigned int *inum, unsigned long *journal_devnum,
ext4_fsblk_t *n_blocks_count, int is_remount) ext4_fsblk_t *n_blocks_count, int is_remount)
{ {
struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_sb_info *sbi = EXT4_SB(sb);
char * p; char *p;
substring_t args[MAX_OPT_ARGS]; substring_t args[MAX_OPT_ARGS];
int data_opt = 0; int data_opt = 0;
int option; int option;
...@@ -1009,7 +1008,7 @@ static int parse_options (char *options, struct super_block *sb, ...@@ -1009,7 +1008,7 @@ static int parse_options (char *options, struct super_block *sb,
if (!options) if (!options)
return 1; return 1;
while ((p = strsep (&options, ",")) != NULL) { while ((p = strsep(&options, ",")) != NULL) {
int token; int token;
if (!*p) if (!*p)
continue; continue;
...@@ -1017,16 +1016,16 @@ static int parse_options (char *options, struct super_block *sb, ...@@ -1017,16 +1016,16 @@ static int parse_options (char *options, struct super_block *sb,
token = match_token(p, tokens, args); token = match_token(p, tokens, args);
switch (token) { switch (token) {
case Opt_bsd_df: case Opt_bsd_df:
clear_opt (sbi->s_mount_opt, MINIX_DF); clear_opt(sbi->s_mount_opt, MINIX_DF);
break; break;
case Opt_minix_df: case Opt_minix_df:
set_opt (sbi->s_mount_opt, MINIX_DF); set_opt(sbi->s_mount_opt, MINIX_DF);
break; break;
case Opt_grpid: case Opt_grpid:
set_opt (sbi->s_mount_opt, GRPID); set_opt(sbi->s_mount_opt, GRPID);
break; break;
case Opt_nogrpid: case Opt_nogrpid:
clear_opt (sbi->s_mount_opt, GRPID); clear_opt(sbi->s_mount_opt, GRPID);
break; break;
case Opt_resuid: case Opt_resuid:
if (match_int(&args[0], &option)) if (match_int(&args[0], &option))
...@@ -1043,41 +1042,41 @@ static int parse_options (char *options, struct super_block *sb, ...@@ -1043,41 +1042,41 @@ static int parse_options (char *options, struct super_block *sb,
/* *sb_block = match_int(&args[0]); */ /* *sb_block = match_int(&args[0]); */
break; break;
case Opt_err_panic: case Opt_err_panic:
clear_opt (sbi->s_mount_opt, ERRORS_CONT); clear_opt(sbi->s_mount_opt, ERRORS_CONT);
clear_opt (sbi->s_mount_opt, ERRORS_RO); clear_opt(sbi->s_mount_opt, ERRORS_RO);
set_opt (sbi->s_mount_opt, ERRORS_PANIC); set_opt(sbi->s_mount_opt, ERRORS_PANIC);
break; break;
case Opt_err_ro: case Opt_err_ro:
clear_opt (sbi->s_mount_opt, ERRORS_CONT); clear_opt(sbi->s_mount_opt, ERRORS_CONT);
clear_opt (sbi->s_mount_opt, ERRORS_PANIC); clear_opt(sbi->s_mount_opt, ERRORS_PANIC);
set_opt (sbi->s_mount_opt, ERRORS_RO); set_opt(sbi->s_mount_opt, ERRORS_RO);
break; break;
case Opt_err_cont: case Opt_err_cont:
clear_opt (sbi->s_mount_opt, ERRORS_RO); clear_opt(sbi->s_mount_opt, ERRORS_RO);
clear_opt (sbi->s_mount_opt, ERRORS_PANIC); clear_opt(sbi->s_mount_opt, ERRORS_PANIC);
set_opt (sbi->s_mount_opt, ERRORS_CONT); set_opt(sbi->s_mount_opt, ERRORS_CONT);
break; break;
case Opt_nouid32: case Opt_nouid32:
set_opt (sbi->s_mount_opt, NO_UID32); set_opt(sbi->s_mount_opt, NO_UID32);
break; break;
case Opt_nocheck: case Opt_nocheck:
clear_opt (sbi->s_mount_opt, CHECK); clear_opt(sbi->s_mount_opt, CHECK);
break; break;
case Opt_debug: case Opt_debug:
set_opt (sbi->s_mount_opt, DEBUG); set_opt(sbi->s_mount_opt, DEBUG);
break; break;
case Opt_oldalloc: case Opt_oldalloc:
set_opt (sbi->s_mount_opt, OLDALLOC); set_opt(sbi->s_mount_opt, OLDALLOC);
break; break;
case Opt_orlov: case Opt_orlov:
clear_opt (sbi->s_mount_opt, OLDALLOC); clear_opt(sbi->s_mount_opt, OLDALLOC);
break; break;
#ifdef CONFIG_EXT4DEV_FS_XATTR #ifdef CONFIG_EXT4DEV_FS_XATTR
case Opt_user_xattr: case Opt_user_xattr:
set_opt (sbi->s_mount_opt, XATTR_USER); set_opt(sbi->s_mount_opt, XATTR_USER);
break; break;
case Opt_nouser_xattr: case Opt_nouser_xattr:
clear_opt (sbi->s_mount_opt, XATTR_USER); clear_opt(sbi->s_mount_opt, XATTR_USER);
break; break;
#else #else
case Opt_user_xattr: case Opt_user_xattr:
...@@ -1115,7 +1114,7 @@ static int parse_options (char *options, struct super_block *sb, ...@@ -1115,7 +1114,7 @@ static int parse_options (char *options, struct super_block *sb,
"journal on remount\n"); "journal on remount\n");
return 0; return 0;
} }
set_opt (sbi->s_mount_opt, UPDATE_JOURNAL); set_opt(sbi->s_mount_opt, UPDATE_JOURNAL);
break; break;
case Opt_journal_inum: case Opt_journal_inum:
if (is_remount) { if (is_remount) {
...@@ -1145,7 +1144,7 @@ static int parse_options (char *options, struct super_block *sb, ...@@ -1145,7 +1144,7 @@ static int parse_options (char *options, struct super_block *sb,
set_opt(sbi->s_mount_opt, JOURNAL_CHECKSUM); set_opt(sbi->s_mount_opt, JOURNAL_CHECKSUM);
break; break;
case Opt_noload: case Opt_noload:
set_opt (sbi->s_mount_opt, NOLOAD); set_opt(sbi->s_mount_opt, NOLOAD);
break; break;
case Opt_commit: case Opt_commit:
if (match_int(&args[0], &option)) if (match_int(&args[0], &option))
...@@ -1331,7 +1330,7 @@ static int parse_options (char *options, struct super_block *sb, ...@@ -1331,7 +1330,7 @@ static int parse_options (char *options, struct super_block *sb,
"on this filesystem, use tune2fs\n"); "on this filesystem, use tune2fs\n");
return 0; return 0;
} }
set_opt (sbi->s_mount_opt, EXTENTS); set_opt(sbi->s_mount_opt, EXTENTS);
break; break;
case Opt_noextents: case Opt_noextents:
/* /*
...@@ -1348,7 +1347,7 @@ static int parse_options (char *options, struct super_block *sb, ...@@ -1348,7 +1347,7 @@ static int parse_options (char *options, struct super_block *sb,
"-o noextents options\n"); "-o noextents options\n");
return 0; return 0;
} }
clear_opt (sbi->s_mount_opt, EXTENTS); clear_opt(sbi->s_mount_opt, EXTENTS);
break; break;
case Opt_i_version: case Opt_i_version:
set_opt(sbi->s_mount_opt, I_VERSION); set_opt(sbi->s_mount_opt, I_VERSION);
...@@ -1374,9 +1373,9 @@ static int parse_options (char *options, struct super_block *sb, ...@@ -1374,9 +1373,9 @@ static int parse_options (char *options, struct super_block *sb,
set_opt(sbi->s_mount_opt, DELALLOC); set_opt(sbi->s_mount_opt, DELALLOC);
break; break;
default: default:
printk (KERN_ERR printk(KERN_ERR
"EXT4-fs: Unrecognized mount option \"%s\" " "EXT4-fs: Unrecognized mount option \"%s\" "
"or missing value\n", p); "or missing value\n", p);
return 0; return 0;
} }
} }
...@@ -1423,31 +1422,31 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es, ...@@ -1423,31 +1422,31 @@ static int ext4_setup_super(struct super_block *sb, struct ext4_super_block *es,
int res = 0; int res = 0;
if (le32_to_cpu(es->s_rev_level) > EXT4_MAX_SUPP_REV) { if (le32_to_cpu(es->s_rev_level) > EXT4_MAX_SUPP_REV) {
printk (KERN_ERR "EXT4-fs warning: revision level too high, " printk(KERN_ERR "EXT4-fs warning: revision level too high, "
"forcing read-only mode\n"); "forcing read-only mode\n");
res = MS_RDONLY; res = MS_RDONLY;
} }
if (read_only) if (read_only)
return res; return res;
if (!(sbi->s_mount_state & EXT4_VALID_FS)) if (!(sbi->s_mount_state & EXT4_VALID_FS))
printk (KERN_WARNING "EXT4-fs warning: mounting unchecked fs, " printk(KERN_WARNING "EXT4-fs warning: mounting unchecked fs, "
"running e2fsck is recommended\n"); "running e2fsck is recommended\n");
else if ((sbi->s_mount_state & EXT4_ERROR_FS)) else if ((sbi->s_mount_state & EXT4_ERROR_FS))
printk (KERN_WARNING printk(KERN_WARNING
"EXT4-fs warning: mounting fs with errors, " "EXT4-fs warning: mounting fs with errors, "
"running e2fsck is recommended\n"); "running e2fsck is recommended\n");
else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 && else if ((__s16) le16_to_cpu(es->s_max_mnt_count) >= 0 &&
le16_to_cpu(es->s_mnt_count) >= le16_to_cpu(es->s_mnt_count) >=
(unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count)) (unsigned short) (__s16) le16_to_cpu(es->s_max_mnt_count))
printk (KERN_WARNING printk(KERN_WARNING
"EXT4-fs warning: maximal mount count reached, " "EXT4-fs warning: maximal mount count reached, "
"running e2fsck is recommended\n"); "running e2fsck is recommended\n");
else if (le32_to_cpu(es->s_checkinterval) && else if (le32_to_cpu(es->s_checkinterval) &&
(le32_to_cpu(es->s_lastcheck) + (le32_to_cpu(es->s_lastcheck) +
le32_to_cpu(es->s_checkinterval) <= get_seconds())) le32_to_cpu(es->s_checkinterval) <= get_seconds()))
printk (KERN_WARNING printk(KERN_WARNING
"EXT4-fs warning: checktime reached, " "EXT4-fs warning: checktime reached, "
"running e2fsck is recommended\n"); "running e2fsck is recommended\n");
#if 0 #if 0
/* @@@ We _will_ want to clear the valid bit if we find /* @@@ We _will_ want to clear the valid bit if we find
* inconsistencies, to force a fsck at reboot. But for * inconsistencies, to force a fsck at reboot. But for
...@@ -1596,16 +1595,14 @@ static int ext4_check_descriptors(struct super_block *sb) ...@@ -1596,16 +1595,14 @@ static int ext4_check_descriptors(struct super_block *sb)
(EXT4_BLOCKS_PER_GROUP(sb) - 1); (EXT4_BLOCKS_PER_GROUP(sb) - 1);
block_bitmap = ext4_block_bitmap(sb, gdp); block_bitmap = ext4_block_bitmap(sb, gdp);
if (block_bitmap < first_block || block_bitmap > last_block) if (block_bitmap < first_block || block_bitmap > last_block) {
{
printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: " printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: "
"Block bitmap for group %lu not in group " "Block bitmap for group %lu not in group "
"(block %llu)!", i, block_bitmap); "(block %llu)!", i, block_bitmap);
return 0; return 0;
} }
inode_bitmap = ext4_inode_bitmap(sb, gdp); inode_bitmap = ext4_inode_bitmap(sb, gdp);
if (inode_bitmap < first_block || inode_bitmap > last_block) if (inode_bitmap < first_block || inode_bitmap > last_block) {
{
printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: " printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: "
"Inode bitmap for group %lu not in group " "Inode bitmap for group %lu not in group "
"(block %llu)!", i, inode_bitmap); "(block %llu)!", i, inode_bitmap);
...@@ -1613,8 +1610,7 @@ static int ext4_check_descriptors(struct super_block *sb) ...@@ -1613,8 +1610,7 @@ static int ext4_check_descriptors(struct super_block *sb)
} }
inode_table = ext4_inode_table(sb, gdp); inode_table = ext4_inode_table(sb, gdp);
if (inode_table < first_block || if (inode_table < first_block ||
inode_table + sbi->s_itb_per_group - 1 > last_block) inode_table + sbi->s_itb_per_group - 1 > last_block) {
{
printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: " printk(KERN_ERR "EXT4-fs: ext4_check_descriptors: "
"Inode table for group %lu not in group " "Inode table for group %lu not in group "
"(block %llu)!", i, inode_table); "(block %llu)!", i, inode_table);
...@@ -1635,7 +1631,7 @@ static int ext4_check_descriptors(struct super_block *sb) ...@@ -1635,7 +1631,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;
} }
...@@ -1656,8 +1652,8 @@ static int ext4_check_descriptors(struct super_block *sb) ...@@ -1656,8 +1652,8 @@ static int ext4_check_descriptors(struct super_block *sb)
* e2fsck was run on this filesystem, and it must have already done the orphan * e2fsck was run on this filesystem, and it must have already done the orphan
* inode cleanup for us, so we can safely abort without any further action. * inode cleanup for us, so we can safely abort without any further action.
*/ */
static void ext4_orphan_cleanup (struct super_block * sb, static void ext4_orphan_cleanup(struct super_block *sb,
struct ext4_super_block * es) struct ext4_super_block *es)
{ {
unsigned int s_flags = sb->s_flags; unsigned int s_flags = sb->s_flags;
int nr_orphans = 0, nr_truncates = 0; int nr_orphans = 0, nr_truncates = 0;
...@@ -1734,7 +1730,7 @@ static void ext4_orphan_cleanup (struct super_block * sb, ...@@ -1734,7 +1730,7 @@ static void ext4_orphan_cleanup (struct super_block * sb,
iput(inode); /* The delete magic happens here! */ iput(inode); /* The delete magic happens here! */
} }
#define PLURAL(x) (x), ((x)==1) ? "" : "s" #define PLURAL(x) (x), ((x) == 1) ? "" : "s"
if (nr_orphans) if (nr_orphans)
printk(KERN_INFO "EXT4-fs: %s: %d orphan inode%s deleted\n", printk(KERN_INFO "EXT4-fs: %s: %d orphan inode%s deleted\n",
...@@ -1901,12 +1897,12 @@ static unsigned long ext4_get_stripe_size(struct ext4_sb_info *sbi) ...@@ -1901,12 +1897,12 @@ static unsigned long ext4_get_stripe_size(struct ext4_sb_info *sbi)
return 0; return 0;
} }
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;
struct ext4_sb_info *sbi; struct ext4_sb_info *sbi;
ext4_fsblk_t block; ext4_fsblk_t block;
...@@ -1955,7 +1951,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -1955,7 +1951,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
} }
if (!(bh = sb_bread(sb, logical_sb_block))) { if (!(bh = sb_bread(sb, logical_sb_block))) {
printk (KERN_ERR "EXT4-fs: unable to read superblock\n"); printk(KERN_ERR "EXT4-fs: unable to read superblock\n");
goto out_fail; goto out_fail;
} }
/* /*
...@@ -2028,8 +2024,8 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2028,8 +2024,8 @@ 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_inum, &journal_devnum, if (!parse_options((char *) data, sb, &journal_inum, &journal_devnum,
NULL, 0)) NULL, 0))
goto failed_mount; goto failed_mount;
sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
...@@ -2104,7 +2100,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2104,7 +2100,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
goto failed_mount; goto failed_mount;
} }
brelse (bh); brelse(bh);
logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE; logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE;
offset = do_div(logical_sb_block, blocksize); offset = do_div(logical_sb_block, blocksize);
bh = sb_bread(sb, logical_sb_block); bh = sb_bread(sb, logical_sb_block);
...@@ -2116,8 +2112,8 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2116,8 +2112,8 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
es = (struct ext4_super_block *)(((char *)bh->b_data) + offset); es = (struct ext4_super_block *)(((char *)bh->b_data) + offset);
sbi->s_es = es; sbi->s_es = es;
if (es->s_magic != cpu_to_le16(EXT4_SUPER_MAGIC)) { if (es->s_magic != cpu_to_le16(EXT4_SUPER_MAGIC)) {
printk (KERN_ERR printk(KERN_ERR
"EXT4-fs: Magic mismatch, very weird !\n"); "EXT4-fs: Magic mismatch, very weird !\n");
goto failed_mount; goto failed_mount;
} }
} }
...@@ -2134,9 +2130,9 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2134,9 +2130,9 @@ 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) ||
(!is_power_of_2(sbi->s_inode_size)) || (!is_power_of_2(sbi->s_inode_size)) ||
(sbi->s_inode_size > blocksize)) { (sbi->s_inode_size > blocksize)) {
printk (KERN_ERR printk(KERN_ERR
"EXT4-fs: unsupported inode size: %d\n", "EXT4-fs: unsupported inode size: %d\n",
sbi->s_inode_size); sbi->s_inode_size);
goto failed_mount; goto failed_mount;
} }
if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE)
...@@ -2168,20 +2164,20 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2168,20 +2164,20 @@ 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;
if (sbi->s_blocks_per_group > blocksize * 8) { if (sbi->s_blocks_per_group > blocksize * 8) {
printk (KERN_ERR printk(KERN_ERR
"EXT4-fs: #blocks per group too big: %lu\n", "EXT4-fs: #blocks per group too big: %lu\n",
sbi->s_blocks_per_group); sbi->s_blocks_per_group);
goto failed_mount; goto failed_mount;
} }
if (sbi->s_inodes_per_group > blocksize * 8) { if (sbi->s_inodes_per_group > blocksize * 8) {
printk (KERN_ERR printk(KERN_ERR
"EXT4-fs: #inodes per group too big: %lu\n", "EXT4-fs: #inodes per group too big: %lu\n",
sbi->s_inodes_per_group); sbi->s_inodes_per_group);
goto failed_mount; goto failed_mount;
} }
...@@ -2215,10 +2211,10 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2215,10 +2211,10 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
sbi->s_groups_count = blocks_count; sbi->s_groups_count = blocks_count;
db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) / db_count = (sbi->s_groups_count + EXT4_DESC_PER_BLOCK(sb) - 1) /
EXT4_DESC_PER_BLOCK(sb); EXT4_DESC_PER_BLOCK(sb);
sbi->s_group_desc = kmalloc(db_count * sizeof (struct buffer_head *), sbi->s_group_desc = kmalloc(db_count * sizeof(struct buffer_head *),
GFP_KERNEL); GFP_KERNEL);
if (sbi->s_group_desc == NULL) { if (sbi->s_group_desc == NULL) {
printk (KERN_ERR "EXT4-fs: not enough memory\n"); printk(KERN_ERR "EXT4-fs: not enough memory\n");
goto failed_mount; goto failed_mount;
} }
...@@ -2228,13 +2224,13 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2228,13 +2224,13 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
block = descriptor_loc(sb, logical_sb_block, i); block = descriptor_loc(sb, logical_sb_block, i);
sbi->s_group_desc[i] = sb_bread(sb, block); sbi->s_group_desc[i] = sb_bread(sb, block);
if (!sbi->s_group_desc[i]) { if (!sbi->s_group_desc[i]) {
printk (KERN_ERR "EXT4-fs: " printk(KERN_ERR "EXT4-fs: "
"can't read group descriptor %d\n", i); "can't read group descriptor %d\n", i);
db_count = i; db_count = i;
goto failed_mount2; goto failed_mount2;
} }
} }
if (!ext4_check_descriptors (sb)) { if (!ext4_check_descriptors(sb)) {
printk(KERN_ERR "EXT4-fs: group descriptors corrupted!\n"); printk(KERN_ERR "EXT4-fs: group descriptors corrupted!\n");
goto failed_mount2; goto failed_mount2;
} }
...@@ -2310,11 +2306,11 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2310,11 +2306,11 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
EXT4_SB(sb)->s_journal->j_failed_commit) { EXT4_SB(sb)->s_journal->j_failed_commit) {
printk(KERN_CRIT "EXT4-fs error (device %s): " printk(KERN_CRIT "EXT4-fs error (device %s): "
"ext4_fill_super: Journal transaction " "ext4_fill_super: Journal transaction "
"%u is corrupt\n", sb->s_id, "%u is corrupt\n", sb->s_id,
EXT4_SB(sb)->s_journal->j_failed_commit); EXT4_SB(sb)->s_journal->j_failed_commit);
if (test_opt (sb, ERRORS_RO)) { if (test_opt(sb, ERRORS_RO)) {
printk (KERN_CRIT printk(KERN_CRIT
"Mounting filesystem read-only\n"); "Mounting filesystem read-only\n");
sb->s_flags |= MS_RDONLY; sb->s_flags |= MS_RDONLY;
EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
es->s_state |= cpu_to_le16(EXT4_ERROR_FS); es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
...@@ -2334,9 +2330,9 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2334,9 +2330,9 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
goto failed_mount3; goto failed_mount3;
} else { } else {
if (!silent) if (!silent)
printk (KERN_ERR printk(KERN_ERR
"ext4: No journal on filesystem on %s\n", "ext4: No journal on filesystem on %s\n",
sb->s_id); sb->s_id);
goto failed_mount3; goto failed_mount3;
} }
...@@ -2420,7 +2416,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2420,7 +2416,7 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
goto failed_mount4; goto failed_mount4;
} }
ext4_setup_super (sb, es, sb->s_flags & MS_RDONLY); ext4_setup_super(sb, es, sb->s_flags & MS_RDONLY);
/* determine the minimum size of new large inodes, if present */ /* determine the minimum size of new large inodes, if present */
if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) { if (sbi->s_inode_size > EXT4_GOOD_OLD_INODE_SIZE) {
...@@ -2459,12 +2455,12 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent) ...@@ -2459,12 +2455,12 @@ static int ext4_fill_super (struct super_block *sb, void *data, int silent)
ext4_orphan_cleanup(sb, es); ext4_orphan_cleanup(sb, es);
EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS; EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;
if (needs_recovery) if (needs_recovery)
printk (KERN_INFO "EXT4-fs: recovery complete.\n"); printk(KERN_INFO "EXT4-fs: recovery complete.\n");
ext4_mark_recovery_complete(sb, es); ext4_mark_recovery_complete(sb, es);
printk (KERN_INFO "EXT4-fs: mounted filesystem with %s data mode.\n", printk(KERN_INFO "EXT4-fs: mounted filesystem with %s data mode.\n",
test_opt(sb,DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ? "journal": test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA ? "journal":
test_opt(sb,DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA ? "ordered": test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA ? "ordered":
"writeback"); "writeback");
if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) {
printk(KERN_WARNING "EXT4-fs: Ignoring delalloc option - " printk(KERN_WARNING "EXT4-fs: Ignoring delalloc option - "
...@@ -2577,14 +2573,14 @@ static journal_t *ext4_get_journal(struct super_block *sb, ...@@ -2577,14 +2573,14 @@ static journal_t *ext4_get_journal(struct super_block *sb,
static journal_t *ext4_get_dev_journal(struct super_block *sb, static journal_t *ext4_get_dev_journal(struct super_block *sb,
dev_t j_dev) dev_t j_dev)
{ {
struct buffer_head * bh; struct buffer_head *bh;
journal_t *journal; journal_t *journal;
ext4_fsblk_t start; ext4_fsblk_t start;
ext4_fsblk_t len; ext4_fsblk_t len;
int hblock, blocksize; int hblock, blocksize;
ext4_fsblk_t sb_block; ext4_fsblk_t sb_block;
unsigned long offset; unsigned long offset;
struct ext4_super_block * es; struct ext4_super_block *es;
struct block_device *bdev; struct block_device *bdev;
bdev = ext4_blkdev_get(j_dev); bdev = ext4_blkdev_get(j_dev);
...@@ -2699,8 +2695,8 @@ static int ext4_load_journal(struct super_block *sb, ...@@ -2699,8 +2695,8 @@ static int ext4_load_journal(struct super_block *sb,
"unavailable, cannot proceed.\n"); "unavailable, cannot proceed.\n");
return -EROFS; return -EROFS;
} }
printk (KERN_INFO "EXT4-fs: write access will " printk(KERN_INFO "EXT4-fs: write access will "
"be enabled during recovery.\n"); "be enabled during recovery.\n");
} }
} }
...@@ -2753,8 +2749,8 @@ static int ext4_load_journal(struct super_block *sb, ...@@ -2753,8 +2749,8 @@ static int ext4_load_journal(struct super_block *sb,
return 0; return 0;
} }
static int ext4_create_journal(struct super_block * sb, static int ext4_create_journal(struct super_block *sb,
struct ext4_super_block * es, struct ext4_super_block *es,
unsigned int journal_inum) unsigned int journal_inum)
{ {
journal_t *journal; journal_t *journal;
...@@ -2795,9 +2791,8 @@ static int ext4_create_journal(struct super_block * sb, ...@@ -2795,9 +2791,8 @@ static int ext4_create_journal(struct super_block * sb,
return 0; return 0;
} }
static void ext4_commit_super (struct super_block * sb, static void ext4_commit_super(struct super_block *sb,
struct ext4_super_block * es, struct ext4_super_block *es, int sync)
int sync)
{ {
struct buffer_head *sbh = EXT4_SB(sb)->s_sbh; struct buffer_head *sbh = EXT4_SB(sb)->s_sbh;
...@@ -2818,8 +2813,8 @@ static void ext4_commit_super (struct super_block * sb, ...@@ -2818,8 +2813,8 @@ static void ext4_commit_super (struct super_block * sb,
* remounting) the filesystem readonly, then we will end up with a * remounting) the filesystem readonly, then we will end up with a
* consistent fs on disk. Record that fact. * consistent fs on disk. Record that fact.
*/ */
static void ext4_mark_recovery_complete(struct super_block * sb, static void ext4_mark_recovery_complete(struct super_block *sb,
struct ext4_super_block * es) struct ext4_super_block *es)
{ {
journal_t *journal = EXT4_SB(sb)->s_journal; journal_t *journal = EXT4_SB(sb)->s_journal;
...@@ -2841,8 +2836,8 @@ static void ext4_mark_recovery_complete(struct super_block * sb, ...@@ -2841,8 +2836,8 @@ static void ext4_mark_recovery_complete(struct super_block * sb,
* has recorded an error from a previous lifetime, move that error to the * has recorded an error from a previous lifetime, move that error to the
* main filesystem now. * main filesystem now.
*/ */
static void ext4_clear_journal_err(struct super_block * sb, static void ext4_clear_journal_err(struct super_block *sb,
struct ext4_super_block * es) struct ext4_super_block *es)
{ {
journal_t *journal; journal_t *journal;
int j_errno; int j_errno;
...@@ -2867,7 +2862,7 @@ static void ext4_clear_journal_err(struct super_block * sb, ...@@ -2867,7 +2862,7 @@ static void ext4_clear_journal_err(struct super_block * sb,
EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS;
es->s_state |= cpu_to_le16(EXT4_ERROR_FS); es->s_state |= cpu_to_le16(EXT4_ERROR_FS);
ext4_commit_super (sb, es, 1); ext4_commit_super(sb, es, 1);
jbd2_journal_clear_err(journal); jbd2_journal_clear_err(journal);
} }
...@@ -2900,7 +2895,7 @@ int ext4_force_commit(struct super_block *sb) ...@@ -2900,7 +2895,7 @@ int ext4_force_commit(struct super_block *sb)
* This implicitly triggers the writebehind on sync(). * This implicitly triggers the writebehind on sync().
*/ */
static void ext4_write_super (struct super_block * sb) static void ext4_write_super(struct super_block *sb)
{ {
if (mutex_trylock(&sb->s_lock) != 0) if (mutex_trylock(&sb->s_lock) != 0)
BUG(); BUG();
...@@ -2956,9 +2951,9 @@ static void ext4_unlockfs(struct super_block *sb) ...@@ -2956,9 +2951,9 @@ static void ext4_unlockfs(struct super_block *sb)
} }
} }
static int ext4_remount (struct super_block * sb, int * flags, char * data) static int ext4_remount(struct super_block *sb, int *flags, char *data)
{ {
struct ext4_super_block * es; struct ext4_super_block *es;
struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_sb_info *sbi = EXT4_SB(sb);
ext4_fsblk_t n_blocks_count = 0; ext4_fsblk_t n_blocks_count = 0;
unsigned long old_sb_flags; unsigned long old_sb_flags;
...@@ -3086,7 +3081,7 @@ static int ext4_remount (struct super_block * sb, int * flags, char * data) ...@@ -3086,7 +3081,7 @@ static int ext4_remount (struct super_block * sb, int * flags, char * data)
sbi->s_mount_state = le16_to_cpu(es->s_state); sbi->s_mount_state = le16_to_cpu(es->s_state);
if ((err = ext4_group_extend(sb, es, n_blocks_count))) if ((err = ext4_group_extend(sb, es, n_blocks_count)))
goto restore_opts; goto restore_opts;
if (!ext4_setup_super (sb, es, 0)) if (!ext4_setup_super(sb, es, 0))
sb->s_flags &= ~MS_RDONLY; sb->s_flags &= ~MS_RDONLY;
} }
} }
...@@ -3116,7 +3111,7 @@ static int ext4_remount (struct super_block * sb, int * flags, char * data) ...@@ -3116,7 +3111,7 @@ static int ext4_remount (struct super_block * sb, int * flags, char * data)
return err; return err;
} }
static int ext4_statfs (struct dentry * dentry, struct kstatfs * buf) static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
{ {
struct super_block *sb = dentry->d_sb; struct super_block *sb = dentry->d_sb;
struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_sb_info *sbi = EXT4_SB(sb);
...@@ -3354,12 +3349,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id, ...@@ -3354,12 +3349,12 @@ static int ext4_quota_on(struct super_block *sb, int type, int format_id,
} }
/* Journaling quota? */ /* Journaling quota? */
if (EXT4_SB(sb)->s_qf_names[type]) { if (EXT4_SB(sb)->s_qf_names[type]) {
/* Quotafile not of fs root? */ /* Quotafile not in fs root? */
if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode)
printk(KERN_WARNING printk(KERN_WARNING
"EXT4-fs: Quota file not on filesystem root. " "EXT4-fs: Quota file not on filesystem root. "
"Journaled quota will not work.\n"); "Journaled quota will not work.\n");
} }
/* /*
* When we journal data on quota file, we have to flush journal to see * When we journal data on quota file, we have to flush journal to see
......
...@@ -1512,7 +1512,7 @@ static inline void ext4_xattr_hash_entry(struct ext4_xattr_header *header, ...@@ -1512,7 +1512,7 @@ static inline void ext4_xattr_hash_entry(struct ext4_xattr_header *header,
char *name = entry->e_name; char *name = entry->e_name;
int n; int n;
for (n=0; n < entry->e_name_len; n++) { for (n = 0; n < entry->e_name_len; n++) {
hash = (hash << NAME_HASH_SHIFT) ^ hash = (hash << NAME_HASH_SHIFT) ^
(hash >> (8*sizeof(hash) - NAME_HASH_SHIFT)) ^ (hash >> (8*sizeof(hash) - NAME_HASH_SHIFT)) ^
*name++; *name++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册