X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fext3%2Fsuper.c;h=27c0fe37d562f2494416339d2a747563f7f80a17;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=4bbb5a078bbb8c781ee9f29794af03b1c02a219f;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 4bbb5a078..27c0fe37d 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -356,7 +356,7 @@ static int ext3_blkdev_remove(struct ext3_sb_info *sbi) bdev = sbi->journal_bdev; if (bdev) { ret = ext3_blkdev_put(bdev); - sbi->journal_bdev = 0; + sbi->journal_bdev = NULL; } return ret; } @@ -521,6 +521,8 @@ static void ext3_clear_inode(struct inode *inode) static int ext3_dquot_initialize(struct inode *inode, int type); static int ext3_dquot_drop(struct inode *inode); static int ext3_write_dquot(struct dquot *dquot); +static int ext3_acquire_dquot(struct dquot *dquot); +static int ext3_release_dquot(struct dquot *dquot); static int ext3_mark_dquot_dirty(struct dquot *dquot); static int ext3_write_info(struct super_block *sb, int type); static int ext3_quota_on(struct super_block *sb, int type, int format_id, char *path); @@ -536,6 +538,8 @@ static struct dquot_operations ext3_quota_operations = { .free_inode = dquot_free_inode, .transfer = dquot_transfer, .write_dquot = ext3_write_dquot, + .acquire_dquot = ext3_acquire_dquot, + .release_dquot = ext3_release_dquot, .mark_dirty = ext3_mark_dquot_dirty, .write_info = ext3_write_info }; @@ -583,7 +587,7 @@ enum { Opt_abort, Opt_data_journal, Opt_data_ordered, Opt_data_writeback, Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota, Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, - Opt_ignore, Opt_err, + Opt_tagxid, Opt_ignore, Opt_err, }; static match_table_t tokens = { @@ -624,6 +628,7 @@ static match_table_t tokens = { {Opt_grpjquota, "grpjquota=%s"}, {Opt_jqfmt_vfsold, "jqfmt=vfsold"}, {Opt_jqfmt_vfsv0, "jqfmt=vfsv0"}, + {Opt_tagxid, "tagxid"}, {Opt_ignore, "grpquota"}, {Opt_ignore, "noquota"}, {Opt_ignore, "quota"}, @@ -717,6 +722,16 @@ static int parse_options (char * options, struct super_block *sb, case Opt_nouid32: set_opt (sbi->s_mount_opt, NO_UID32); break; +#ifndef CONFIG_INOXID_NONE + case Opt_tagxid: + if (is_remount) { + printk(KERN_ERR "EXT3-fs: cannot specify " + "tagxid on remount\n"); + return 0; + } + set_opt (sbi->s_mount_opt, TAG_XID); + break; +#endif case Opt_check: #ifdef CONFIG_EXT3_CHECK set_opt (sbi->s_mount_opt, CHECK); @@ -1197,7 +1212,7 @@ static unsigned long descriptor_loc(struct super_block *sb, static int ext3_fill_super (struct super_block *sb, void *data, int silent) { struct buffer_head * bh; - struct ext3_super_block *es = 0; + struct ext3_super_block *es = NULL; struct ext3_sb_info *sbi; unsigned long block; unsigned long sb_block = get_sb_block(&data); @@ -1287,6 +1302,8 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) if (!parse_options ((char *) data, sb, &journal_inum, 0)) goto failed_mount; + if (EXT3_SB(sb)->s_mount_opt & EXT3_MOUNT_TAG_XID) + sb->s_flags |= MS_TAGXID; sb->s_flags |= MS_ONE_SECOND; sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); @@ -1469,7 +1486,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) #endif INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */ - sb->s_root = 0; + sb->s_root = NULL; needs_recovery = (es->s_last_orphan != 0 || EXT3_HAS_INCOMPAT_FEATURE(sb, @@ -1639,6 +1656,7 @@ static journal_t *ext3_get_journal(struct super_block *sb, int journal_inum) if (!journal) { printk(KERN_ERR "EXT3-fs: Could not load journal inode\n"); iput(journal_inode); + return NULL; } journal->j_private = sb; ext3_init_journal_params(EXT3_SB(sb), journal); @@ -1870,13 +1888,17 @@ static void ext3_commit_super (struct super_block * sb, static void ext3_mark_recovery_complete(struct super_block * sb, struct ext3_super_block * es) { - journal_flush(EXT3_SB(sb)->s_journal); + journal_t *journal = EXT3_SB(sb)->s_journal; + + journal_lock_updates(journal); + journal_flush(journal); if (EXT3_HAS_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER) && sb->s_flags & MS_RDONLY) { EXT3_CLEAR_INCOMPAT_FEATURE(sb, EXT3_FEATURE_INCOMPAT_RECOVER); sb->s_dirt = 0; ext3_commit_super(sb, es, 1); } + journal_unlock_updates(journal); } /* @@ -2181,6 +2203,38 @@ static int ext3_write_dquot(struct dquot *dquot) return ret; } +static int ext3_acquire_dquot(struct dquot *dquot) +{ + int ret, err; + handle_t *handle; + + handle = ext3_journal_start(dquot_to_inode(dquot), + EXT3_QUOTA_INIT_BLOCKS); + if (IS_ERR(handle)) + return PTR_ERR(handle); + ret = dquot_acquire(dquot); + err = ext3_journal_stop(handle); + if (!ret) + ret = err; + return ret; +} + +static int ext3_release_dquot(struct dquot *dquot) +{ + int ret, err; + handle_t *handle; + + handle = ext3_journal_start(dquot_to_inode(dquot), + EXT3_QUOTA_INIT_BLOCKS); + if (IS_ERR(handle)) + return PTR_ERR(handle); + ret = dquot_release(dquot); + err = ext3_journal_stop(handle); + if (!ret) + ret = err; + return ret; +} + static int ext3_mark_dquot_dirty(struct dquot *dquot) { /* Are we journalling quotas? */