Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 218864
b: refs/heads/master
c: 857ac88
h: refs/heads/master
v: v3
  • Loading branch information
Lukas Czerner authored and Theodore Ts'o committed Oct 28, 2010
1 parent d096b7f commit 7f5fd06
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bfff68738f1cb5c93dab1114634cea02aae9e7ba
refs/heads/master: 857ac889cce8a486d47874db4d2f9620e7e9e5de
5 changes: 5 additions & 0 deletions trunk/fs/ext4/ext4.h
Original file line number Diff line number Diff line change
Expand Up @@ -1574,6 +1574,11 @@ struct ext4_li_request {
unsigned long lr_timeout;
};

struct ext4_features {
struct kobject f_kobj;
struct completion f_kobj_unregister;
};

/*
* Function prototypes
*/
Expand Down
19 changes: 10 additions & 9 deletions trunk/fs/ext4/ialloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,16 @@ extern int ext4_init_inode_table(struct super_block *sb, ext4_group_t group,
ext4_itable_unused_count(sb, gdp)),
sbi->s_inodes_per_block);

if ((used_blks < 0) || (used_blks > sbi->s_itb_per_group)) {
ext4_error(sb, "Something is wrong with group %u\n"
"Used itable blocks: %d"
"itable unused count: %u\n",
group, used_blks,
ext4_itable_unused_count(sb, gdp));
ret = 1;
goto out;
}

blk = ext4_inode_table(sb, gdp) + used_blks;
num = sbi->s_itb_per_group - used_blks;

Expand All @@ -1283,15 +1293,6 @@ extern int ext4_init_inode_table(struct super_block *sb, ext4_group_t group,
if (ret)
goto err_out;

if (unlikely(num > EXT4_INODES_PER_GROUP(sb))) {
ext4_error(sb, "Something is wrong with group %u\n"
"Used itable blocks: %d"
"Itable blocks per group: %lu\n",
group, used_blks, sbi->s_itb_per_group);
ret = 1;
goto err_out;
}

/*
* Skip zeroout if the inode table is full. But we set the ZEROED
* flag anyway, because obviously, when it is full it does not need
Expand Down
52 changes: 50 additions & 2 deletions trunk/fs/ext4/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ struct proc_dir_entry *ext4_proc_root;
static struct kset *ext4_kset;
struct ext4_lazy_init *ext4_li_info;
struct mutex ext4_li_mtx;
struct ext4_features *ext4_feat;

static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
unsigned long journal_devnum);
Expand Down Expand Up @@ -709,6 +710,7 @@ static void ext4_put_super(struct super_block *sb)
struct ext4_super_block *es = sbi->s_es;
int i, err;

ext4_unregister_li_request(sb);
dquot_disable(sb, -1, DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);

flush_workqueue(sbi->dio_unwritten_wq);
Expand All @@ -727,7 +729,6 @@ static void ext4_put_super(struct super_block *sb)
}

del_timer(&sbi->s_err_report);
ext4_unregister_li_request(sb);
ext4_release_system_zone(sb);
ext4_mb_release(sb);
ext4_ext_release(sb);
Expand Down Expand Up @@ -2416,6 +2417,7 @@ static struct ext4_attr ext4_attr_##_name = { \
#define EXT4_ATTR(name, mode, show, store) \
static struct ext4_attr ext4_attr_##name = __ATTR(name, mode, show, store)

#define EXT4_INFO_ATTR(name) EXT4_ATTR(name, 0444, NULL, NULL)
#define EXT4_RO_ATTR(name) EXT4_ATTR(name, 0444, name##_show, NULL)
#define EXT4_RW_ATTR(name) EXT4_ATTR(name, 0644, name##_show, name##_store)
#define EXT4_RW_ATTR_SBI_UI(name, elname) \
Expand Down Expand Up @@ -2452,6 +2454,14 @@ static struct attribute *ext4_attrs[] = {
NULL,
};

/* Features this copy of ext4 supports */
EXT4_INFO_ATTR(lazy_itable_init);

static struct attribute *ext4_feat_attrs[] = {
ATTR_LIST(lazy_itable_init),
NULL,
};

static ssize_t ext4_attr_show(struct kobject *kobj,
struct attribute *attr, char *buf)
{
Expand Down Expand Up @@ -2480,7 +2490,6 @@ static void ext4_sb_release(struct kobject *kobj)
complete(&sbi->s_kobj_unregister);
}


static const struct sysfs_ops ext4_attr_ops = {
.show = ext4_attr_show,
.store = ext4_attr_store,
Expand All @@ -2492,6 +2501,17 @@ static struct kobj_type ext4_ktype = {
.release = ext4_sb_release,
};

static void ext4_feat_release(struct kobject *kobj)
{
complete(&ext4_feat->f_kobj_unregister);
}

static struct kobj_type ext4_feat_ktype = {
.default_attrs = ext4_feat_attrs,
.sysfs_ops = &ext4_attr_ops,
.release = ext4_feat_release,
};

/*
* Check whether this filesystem can be mounted based on
* the features present and the RDONLY/RDWR mount requested.
Expand Down Expand Up @@ -4720,6 +4740,30 @@ static struct file_system_type ext4_fs_type = {
.fs_flags = FS_REQUIRES_DEV,
};

int __init ext4_init_feat_adverts(void)
{
struct ext4_features *ef;
int ret = -ENOMEM;

ef = kzalloc(sizeof(struct ext4_features), GFP_KERNEL);
if (!ef)
goto out;

ef->f_kobj.kset = ext4_kset;
init_completion(&ef->f_kobj_unregister);
ret = kobject_init_and_add(&ef->f_kobj, &ext4_feat_ktype, NULL,
"features");
if (ret) {
kfree(ef);
goto out;
}

ext4_feat = ef;
ret = 0;
out:
return ret;
}

static int __init init_ext4_fs(void)
{
int err;
Expand All @@ -4732,6 +4776,9 @@ static int __init init_ext4_fs(void)
if (!ext4_kset)
goto out4;
ext4_proc_root = proc_mkdir("fs/ext4", NULL);

err = ext4_init_feat_adverts();

err = init_ext4_mballoc();
if (err)
goto out3;
Expand Down Expand Up @@ -4760,6 +4807,7 @@ static int __init init_ext4_fs(void)
out2:
exit_ext4_mballoc();
out3:
kfree(ext4_feat);
remove_proc_entry("fs/ext4", NULL);
kset_unregister(ext4_kset);
out4:
Expand Down

0 comments on commit 7f5fd06

Please sign in to comment.