Skip to content

Commit 1366f5d

Browse files
committed
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs
Pull quota updates from Jan Kara: "Quota improvements and some minor cleanups. The main portion in the pull request are changes which move i_dquot array from struct inode into fs-private part of an inode which saves memory for filesystems which don't use VFS quotas" * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs: udf: One function call less in udf_fill_super() after error detection udf: Deletion of unnecessary checks before the function call "iput" jbd: Deletion of an unnecessary check before the function call "iput" vfs: Remove i_dquot field from inode jfs: Convert to private i_dquot field reiserfs: Convert to private i_dquot field ocfs2: Convert to private i_dquot field ext4: Convert to private i_dquot field ext3: Convert to private i_dquot field ext2: Convert to private i_dquot field quota: Use function to provide i_dquot pointers xfs: Set allowed quota types gfs2: Set allowed quota types quota: Allow each filesystem to specify which quota types it supports quota: Remove const from function declarations quota: Add log level to printk
2 parents 4b0a268 + fdf2657 commit 1366f5d

22 files changed

Lines changed: 138 additions & 47 deletions

File tree

‎fs/ext2/ext2.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,9 @@ struct ext2_inode_info {
689689
struct mutex truncate_mutex;
690690
struct inode vfs_inode;
691691
struct list_head i_orphan; /* unlinked but open inodes */
692+
#ifdef CONFIG_QUOTA
693+
struct dquot *i_dquot[MAXQUOTAS];
694+
#endif
692695
};
693696

694697
/*

‎fs/ext2/super.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,10 @@ static struct inode *ext2_alloc_inode(struct super_block *sb)
166166
return NULL;
167167
ei->i_block_alloc_info = NULL;
168168
ei->vfs_inode.i_version = 1;
169+
#ifdef CONFIG_QUOTA
170+
memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
171+
#endif
172+
169173
return &ei->vfs_inode;
170174
}
171175

@@ -303,6 +307,10 @@ static int ext2_show_options(struct seq_file *seq, struct dentry *root)
303307
#ifdef CONFIG_QUOTA
304308
static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off);
305309
static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off);
310+
static struct dquot **ext2_get_dquots(struct inode *inode)
311+
{
312+
return EXT2_I(inode)->i_dquot;
313+
}
306314
#endif
307315

308316
static const struct super_operations ext2_sops = {
@@ -320,6 +328,7 @@ static const struct super_operations ext2_sops = {
320328
#ifdef CONFIG_QUOTA
321329
.quota_read = ext2_quota_read,
322330
.quota_write = ext2_quota_write,
331+
.get_dquots = ext2_get_dquots,
323332
#endif
324333
};
325334

@@ -1090,6 +1099,7 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
10901099
#ifdef CONFIG_QUOTA
10911100
sb->dq_op = &dquot_operations;
10921101
sb->s_qcop = &dquot_quotactl_ops;
1102+
sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP;
10931103
#endif
10941104

10951105
root = ext2_iget(sb, EXT2_ROOT_INO);

‎fs/ext3/ext3.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,10 @@ struct ext3_inode_info {
615615
atomic_t i_sync_tid;
616616
atomic_t i_datasync_tid;
617617

618+
#ifdef CONFIG_QUOTA
619+
struct dquot *i_dquot[MAXQUOTAS];
620+
#endif
621+
618622
struct inode vfs_inode;
619623
};
620624

‎fs/ext3/super.c‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,10 @@ static struct inode *ext3_alloc_inode(struct super_block *sb)
485485
ei->vfs_inode.i_version = 1;
486486
atomic_set(&ei->i_datasync_tid, 0);
487487
atomic_set(&ei->i_sync_tid, 0);
488+
#ifdef CONFIG_QUOTA
489+
memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
490+
#endif
491+
488492
return &ei->vfs_inode;
489493
}
490494

@@ -764,6 +768,10 @@ static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data,
764768
size_t len, loff_t off);
765769
static ssize_t ext3_quota_write(struct super_block *sb, int type,
766770
const char *data, size_t len, loff_t off);
771+
static struct dquot **ext3_get_dquots(struct inode *inode)
772+
{
773+
return EXT3_I(inode)->i_dquot;
774+
}
767775

768776
static const struct dquot_operations ext3_quota_operations = {
769777
.write_dquot = ext3_write_dquot,
@@ -803,6 +811,7 @@ static const struct super_operations ext3_sops = {
803811
#ifdef CONFIG_QUOTA
804812
.quota_read = ext3_quota_read,
805813
.quota_write = ext3_quota_write,
814+
.get_dquots = ext3_get_dquots,
806815
#endif
807816
.bdev_try_to_free_page = bdev_try_to_free_page,
808817
};
@@ -2001,6 +2010,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
20012010
#ifdef CONFIG_QUOTA
20022011
sb->s_qcop = &ext3_qctl_operations;
20032012
sb->dq_op = &ext3_quota_operations;
2013+
sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP;
20042014
#endif
20052015
memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
20062016
INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */

‎fs/ext4/ext4.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,10 @@ struct ext4_inode_info {
941941
tid_t i_sync_tid;
942942
tid_t i_datasync_tid;
943943

944+
#ifdef CONFIG_QUOTA
945+
struct dquot *i_dquot[MAXQUOTAS];
946+
#endif
947+
944948
/* Precomputed uuid+inum+igen checksum for seeding inode checksums */
945949
__u32 i_csum_seed;
946950
};

‎fs/ext4/super.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,7 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
892892
spin_lock_init(&(ei->i_block_reservation_lock));
893893
#ifdef CONFIG_QUOTA
894894
ei->i_reserved_quota = 0;
895+
memset(&ei->i_dquot, 0, sizeof(ei->i_dquot));
895896
#endif
896897
ei->jinode = NULL;
897898
INIT_LIST_HEAD(&ei->i_rsv_conversion_list);
@@ -1068,6 +1069,11 @@ static int ext4_quota_enable(struct super_block *sb, int type, int format_id,
10681069
unsigned int flags);
10691070
static int ext4_enable_quotas(struct super_block *sb);
10701071

1072+
static struct dquot **ext4_get_dquots(struct inode *inode)
1073+
{
1074+
return EXT4_I(inode)->i_dquot;
1075+
}
1076+
10711077
static const struct dquot_operations ext4_quota_operations = {
10721078
.get_reserved_space = ext4_get_reserved_space,
10731079
.write_dquot = ext4_write_dquot,
@@ -1117,6 +1123,7 @@ static const struct super_operations ext4_sops = {
11171123
#ifdef CONFIG_QUOTA
11181124
.quota_read = ext4_quota_read,
11191125
.quota_write = ext4_quota_write,
1126+
.get_dquots = ext4_get_dquots,
11201127
#endif
11211128
.bdev_try_to_free_page = bdev_try_to_free_page,
11221129
};
@@ -3932,6 +3939,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
39323939
sb->s_qcop = &ext4_qctl_sysfile_operations;
39333940
else
39343941
sb->s_qcop = &ext4_qctl_operations;
3942+
sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP;
39353943
#endif
39363944
memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid));
39373945

‎fs/gfs2/ops_fstype.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent
10741074
sb->s_export_op = &gfs2_export_ops;
10751075
sb->s_xattr = gfs2_xattr_handlers;
10761076
sb->s_qcop = &gfs2_quotactl_ops;
1077+
sb->s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP;
10771078
sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE;
10781079
sb->s_time_gran = 1;
10791080
sb->s_maxbytes = MAX_LFS_FILESIZE;

‎fs/inode.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,6 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
143143
inode->i_blocks = 0;
144144
inode->i_bytes = 0;
145145
inode->i_generation = 0;
146-
#ifdef CONFIG_QUOTA
147-
memset(&inode->i_dquot, 0, sizeof(inode->i_dquot));
148-
#endif
149146
inode->i_pipe = NULL;
150147
inode->i_bdev = NULL;
151148
inode->i_cdev = NULL;

‎fs/jbd/journal.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,8 +1373,7 @@ int journal_destroy(journal_t *journal)
13731373
}
13741374
mutex_unlock(&journal->j_checkpoint_mutex);
13751375

1376-
if (journal->j_inode)
1377-
iput(journal->j_inode);
1376+
iput(journal->j_inode);
13781377
if (journal->j_revoke)
13791378
journal_destroy_revoke(journal);
13801379
kfree(journal->j_wbuf);

‎fs/jfs/jfs_incore.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ struct jfs_inode_info {
9494
unchar _inline_ea[128]; /* 128: inline extended attr */
9595
} link;
9696
} u;
97+
#ifdef CONFIG_QUOTA
98+
struct dquot *i_dquot[MAXQUOTAS];
99+
#endif
97100
u32 dev; /* will die when we get wide dev_t */
98101
struct inode vfs_inode;
99102
};

0 commit comments

Comments
 (0)