- rename sb_dqopt(sb) to dqopts(sb): returns quota_info structure of the sb - add new sb_dqopts(dquot): returns quota_info structure of the sb dquot belongs to. This helps us to make code more readable. Signed-off-by: Dmitry Monakhov <dmonakhov@xxxxxxxxxx> --- fs/ext2/super.c | 4 +- fs/ext3/super.c | 8 ++-- fs/ext4/super.c | 8 ++-- fs/gfs2/ops_fstype.c | 2 +- fs/jfs/super.c | 4 +- fs/ocfs2/quota_global.c | 12 ++-- fs/ocfs2/quota_local.c | 34 +++++++------- fs/ocfs2/super.c | 6 +- fs/quota/dquot.c | 114 +++++++++++++++++++++++----------------------- fs/quota/quota_tree.c | 2 +- fs/quota/quota_v1.c | 14 +++--- fs/reiserfs/super.c | 6 +- include/linux/quota.h | 1 + include/linux/quotaops.h | 14 ++++-- 14 files changed, 117 insertions(+), 112 deletions(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 1ec6026..7727491 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1371,7 +1371,7 @@ static int ext2_get_sb(struct file_system_type *fs_type, static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off) { - struct inode *inode = sb_dqopt(sb)->files[type]; + struct inode *inode = dqopts(sb)->files[type]; sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb); int err = 0; int offset = off & (sb->s_blocksize - 1); @@ -1416,7 +1416,7 @@ static ssize_t ext2_quota_read(struct super_block *sb, int type, char *data, static ssize_t ext2_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off) { - struct inode *inode = sb_dqopt(sb)->files[type]; + struct inode *inode = dqopts(sb)->files[type]; sector_t blk = off >> EXT2_BLOCK_SIZE_BITS(sb); int err = 0; int offset = off & (sb->s_blocksize - 1); diff --git a/fs/ext3/super.c b/fs/ext3/super.c index e0f68f0..5cd148a 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c @@ -1530,7 +1530,7 @@ static void ext3_orphan_cleanup (struct super_block * sb, #ifdef CONFIG_QUOTA /* Turn quotas off */ for (i = 0; i < MAXQUOTAS; i++) { - if (sb_dqopt(sb)->files[i]) + if (dqopts(sb)->files[i]) dquot_quota_off(sb, i); } #endif @@ -2788,7 +2788,7 @@ static int ext3_statfs (struct dentry * dentry, struct kstatfs * buf) static inline struct inode *dquot_to_inode(struct dquot *dquot) { - return sb_dqopt(dquot->dq_sb)->files[dquot->dq_type]; + return sb_dqopts(dquot)->files[dquot->dq_type]; } static int ext3_write_dquot(struct dquot *dquot) @@ -2931,7 +2931,7 @@ static int ext3_quota_on(struct super_block *sb, int type, int format_id, static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off) { - struct inode *inode = sb_dqopt(sb)->files[type]; + struct inode *inode = dqopts(sb)->files[type]; sector_t blk = off >> EXT3_BLOCK_SIZE_BITS(sb); int err = 0; int offset = off & (sb->s_blocksize - 1); @@ -2969,7 +2969,7 @@ static ssize_t ext3_quota_read(struct super_block *sb, int type, char *data, static ssize_t ext3_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off) { - struct inode *inode = sb_dqopt(sb)->files[type]; + struct inode *inode = dqopts(sb)->files[type]; sector_t blk = off >> EXT3_BLOCK_SIZE_BITS(sb); int err = 0; int offset = off & (sb->s_blocksize - 1); diff --git a/fs/ext4/super.c b/fs/ext4/super.c index a2e68f9..053aee4 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2116,7 +2116,7 @@ static void ext4_orphan_cleanup(struct super_block *sb, #ifdef CONFIG_QUOTA /* Turn quotas off */ for (i = 0; i < MAXQUOTAS; i++) { - if (sb_dqopt(sb)->files[i]) + if (dqopts(sb)->files[i]) dquot_quota_off(sb, i); } #endif @@ -3969,7 +3969,7 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf) static inline struct inode *dquot_to_inode(struct dquot *dquot) { - return sb_dqopt(dquot->dq_sb)->files[dquot->dq_type]; + return sb_dqopts(dquot)->files[dquot->dq_type]; } static int ext4_write_dquot(struct dquot *dquot) @@ -4124,7 +4124,7 @@ static int ext4_quota_off(struct super_block *sb, int type) static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off) { - struct inode *inode = sb_dqopt(sb)->files[type]; + struct inode *inode = dqopts(sb)->files[type]; ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); int err = 0; int offset = off & (sb->s_blocksize - 1); @@ -4162,7 +4162,7 @@ static ssize_t ext4_quota_read(struct super_block *sb, int type, char *data, static ssize_t ext4_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off) { - struct inode *inode = sb_dqopt(sb)->files[type]; + struct inode *inode = dqopts(sb)->files[type]; ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); int err = 0; int offset = off & (sb->s_blocksize - 1); diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 4d4b1e8..1e52207 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1168,7 +1168,7 @@ static int fill_super(struct super_block *sb, struct gfs2_args *args, int silent sb->s_export_op = &gfs2_export_ops; sb->s_xattr = gfs2_xattr_handlers; sb->s_qcop = &gfs2_quotactl_ops; - sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE; + dqopts(sb)->flags |= DQUOT_QUOTA_SYS_FILE; sb->s_time_gran = 1; sb->s_maxbytes = MAX_LFS_FILESIZE; diff --git a/fs/jfs/super.c b/fs/jfs/super.c index ec8c3e4..b612adf 100644 --- a/fs/jfs/super.c +++ b/fs/jfs/super.c @@ -655,7 +655,7 @@ static int jfs_show_options(struct seq_file *seq, struct vfsmount *vfs) static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off) { - struct inode *inode = sb_dqopt(sb)->files[type]; + struct inode *inode = dqopts(sb)->files[type]; sector_t blk = off >> sb->s_blocksize_bits; int err = 0; int offset = off & (sb->s_blocksize - 1); @@ -700,7 +700,7 @@ static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data, static ssize_t jfs_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off) { - struct inode *inode = sb_dqopt(sb)->files[type]; + struct inode *inode = dqopts(sb)->files[type]; sector_t blk = off >> sb->s_blocksize_bits; int err = 0; int offset = off & (sb->s_blocksize - 1); diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index 4607923..cdae8d1 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c @@ -610,7 +610,7 @@ static int ocfs2_sync_dquot_helper(struct dquot *dquot, unsigned long type) mlog_errno(status); goto out_ilock; } - mutex_lock(&sb_dqopt(sb)->dqio_mutex); + mutex_lock(&dqopts(sb)->dqio_mutex); status = ocfs2_sync_dquot(dquot); if (status < 0) mlog_errno(status); @@ -618,7 +618,7 @@ static int ocfs2_sync_dquot_helper(struct dquot *dquot, unsigned long type) status = ocfs2_local_write_dquot(dquot); if (status < 0) mlog_errno(status); - mutex_unlock(&sb_dqopt(sb)->dqio_mutex); + mutex_unlock(&dqopts(sb)->dqio_mutex); ocfs2_commit_trans(osb, handle); out_ilock: ocfs2_unlock_global_qf(oinfo, 1); @@ -657,9 +657,9 @@ static int ocfs2_write_dquot(struct dquot *dquot) mlog_errno(status); goto out; } - mutex_lock(&sb_dqopt(dquot->dq_sb)->dqio_mutex); + mutex_lock(&sb_dqopts(dquot)->dqio_mutex); status = ocfs2_local_write_dquot(dquot); - mutex_unlock(&sb_dqopt(dquot->dq_sb)->dqio_mutex); + mutex_unlock(&sb_dqopts(dquot)->dqio_mutex); ocfs2_commit_trans(osb, handle); out: mlog_exit(status); @@ -854,7 +854,7 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot) mlog_errno(status); goto out_ilock; } - mutex_lock(&sb_dqopt(sb)->dqio_mutex); + mutex_lock(&dqopts(sb)->dqio_mutex); status = ocfs2_sync_dquot(dquot); if (status < 0) { mlog_errno(status); @@ -863,7 +863,7 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot) /* Now write updated local dquot structure */ status = ocfs2_local_write_dquot(dquot); out_dlock: - mutex_unlock(&sb_dqopt(sb)->dqio_mutex); + mutex_unlock(&dqopts(sb)->dqio_mutex); ocfs2_commit_trans(osb, handle); out_ilock: ocfs2_unlock_global_qf(oinfo, 1); diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index dc78764..056cb24 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c @@ -173,7 +173,7 @@ static int ocfs2_local_check_quota_file(struct super_block *sb, int type) unsigned int ino[MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE, GROUP_QUOTA_SYSTEM_INODE }; struct buffer_head *bh = NULL; - struct inode *linode = sb_dqopt(sb)->files[type]; + struct inode *linode = dqopts(sb)->files[type]; struct inode *ginode = NULL; struct ocfs2_disk_dqheader *dqhead; int status, ret = 0; @@ -522,7 +522,7 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode, mlog_errno(status); goto out_drop_lock; } - mutex_lock(&sb_dqopt(sb)->dqio_mutex); + mutex_lock(&dqopts(sb)->dqio_mutex); spin_lock(&dq_data_lock); /* Add usage from quota entry into quota changes * of our node. Auxiliary variables are important @@ -555,7 +555,7 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode, unlock_buffer(qbh); ocfs2_journal_dirty(handle, qbh); out_commit: - mutex_unlock(&sb_dqopt(sb)->dqio_mutex); + mutex_unlock(&dqopts(sb)->dqio_mutex); ocfs2_commit_trans(OCFS2_SB(sb), handle); out_drop_lock: ocfs2_unlock_global_qf(oinfo, 1); @@ -596,7 +596,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, unsigned int flags; mlog(ML_NOTICE, "Finishing quota recovery in slot %u\n", slot_num); - mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_lock(&dqopts(sb)->dqonoff_mutex); for (type = 0; type < MAXQUOTAS; type++) { if (list_empty(&(rec->r_list[type]))) continue; @@ -672,7 +672,7 @@ out_put: break; } out: - mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_unlock(&dqopts(sb)->dqonoff_mutex); kfree(rec); return status; } @@ -683,7 +683,7 @@ static int ocfs2_local_read_info(struct super_block *sb, int type) struct ocfs2_local_disk_dqinfo *ldinfo; struct mem_dqinfo *info = sb_dqinfo(sb, type); struct ocfs2_mem_dqinfo *oinfo; - struct inode *lqinode = sb_dqopt(sb)->files[type]; + struct inode *lqinode = dqopts(sb)->files[type]; int status; struct buffer_head *bh = NULL; struct ocfs2_quota_recovery *rec; @@ -691,7 +691,7 @@ static int ocfs2_local_read_info(struct super_block *sb, int type) /* We don't need the lock and we have to acquire quota file locks * which will later depend on this lock */ - mutex_unlock(&sb_dqopt(sb)->dqio_mutex); + mutex_unlock(&dqopts(sb)->dqio_mutex); info->dqi_maxblimit = 0x7fffffffffffffffLL; info->dqi_maxilimit = 0x7fffffffffffffffLL; oinfo = kmalloc(sizeof(struct ocfs2_mem_dqinfo), GFP_NOFS); @@ -770,7 +770,7 @@ static int ocfs2_local_read_info(struct super_block *sb, int type) goto out_err; } - mutex_lock(&sb_dqopt(sb)->dqio_mutex); + mutex_lock(&dqopts(sb)->dqio_mutex); return 0; out_err: if (oinfo) { @@ -784,7 +784,7 @@ out_err: kfree(oinfo); } brelse(bh); - mutex_lock(&sb_dqopt(sb)->dqio_mutex); + mutex_lock(&dqopts(sb)->dqio_mutex); return -1; } @@ -796,7 +796,7 @@ static int ocfs2_local_write_info(struct super_block *sb, int type) ->dqi_libh; int status; - status = ocfs2_modify_bh(sb_dqopt(sb)->files[type], bh, olq_update_info, + status = ocfs2_modify_bh(dqopts(sb)->files[type], bh, olq_update_info, info); if (status < 0) { mlog_errno(status); @@ -849,7 +849,7 @@ static int ocfs2_local_free_info(struct super_block *sb, int type) /* Mark local file as clean */ info->dqi_flags |= OLQF_CLEAN; - status = ocfs2_modify_bh(sb_dqopt(sb)->files[type], + status = ocfs2_modify_bh(dqopts(sb)->files[type], oinfo->dqi_libh, olq_update_info, info); @@ -859,7 +859,7 @@ static int ocfs2_local_free_info(struct super_block *sb, int type) } out: - ocfs2_inode_unlock(sb_dqopt(sb)->files[type], 1); + ocfs2_inode_unlock(dqopts(sb)->files[type], 1); brelse(oinfo->dqi_libh); brelse(oinfo->dqi_lqi_bh); kfree(oinfo); @@ -893,7 +893,7 @@ int ocfs2_local_write_dquot(struct dquot *dquot) struct super_block *sb = dquot->dq_sb; struct ocfs2_dquot *od = OCFS2_DQUOT(dquot); struct buffer_head *bh; - struct inode *lqinode = sb_dqopt(sb)->files[dquot->dq_type]; + struct inode *lqinode = dqopts(sb)->files[dquot->dq_type]; int status; status = ocfs2_read_quota_phys_block(lqinode, od->dq_local_phys_blk, @@ -962,7 +962,7 @@ static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk( { struct mem_dqinfo *info = sb_dqinfo(sb, type); struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv; - struct inode *lqinode = sb_dqopt(sb)->files[type]; + struct inode *lqinode = dqopts(sb)->files[type]; struct ocfs2_quota_chunk *chunk = NULL; struct ocfs2_local_disk_chunk *dchunk; int status; @@ -1094,7 +1094,7 @@ static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file( struct mem_dqinfo *info = sb_dqinfo(sb, type); struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv; struct ocfs2_quota_chunk *chunk; - struct inode *lqinode = sb_dqopt(sb)->files[type]; + struct inode *lqinode = dqopts(sb)->files[type]; struct ocfs2_local_disk_chunk *dchunk; int epb = ol_quota_entries_per_block(sb); unsigned int chunk_blocks; @@ -1215,7 +1215,7 @@ int ocfs2_create_local_dquot(struct dquot *dquot) { struct super_block *sb = dquot->dq_sb; int type = dquot->dq_type; - struct inode *lqinode = sb_dqopt(sb)->files[type]; + struct inode *lqinode = dqopts(sb)->files[type]; struct ocfs2_quota_chunk *chunk; struct ocfs2_dquot *od = OCFS2_DQUOT(dquot); int offset; @@ -1275,7 +1275,7 @@ int ocfs2_local_release_dquot(handle_t *handle, struct dquot *dquot) int offset; status = ocfs2_journal_access_dq(handle, - INODE_CACHE(sb_dqopt(sb)->files[type]), + INODE_CACHE(dqopts(sb)->files[type]), od->dq_chunk->qc_headerbh, OCFS2_JOURNAL_ACCESS_WRITE); if (status < 0) { mlog_errno(status); diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 8e6a20c..16065ae 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -907,7 +907,7 @@ static int ocfs2_enable_quotas(struct ocfs2_super *osb) int status; int type; - sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NEGATIVE_USAGE; + dqopts(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NEGATIVE_USAGE; for (type = 0; type < MAXQUOTAS; type++) { if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) continue; @@ -949,7 +949,7 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb) /* Cancel periodic syncing before we grab dqonoff_mutex */ oinfo = sb_dqinfo(sb, type)->dqi_priv; cancel_delayed_work_sync(&oinfo->dqi_sync_work); - inode = igrab(sb->s_dquot.files[type]); + inode = igrab(dqopts(sb)->files[type]); /* Turn off quotas. This will remove all dquot structures from * memory and so they will be automatically synced to global * quota files */ @@ -970,7 +970,7 @@ static int ocfs2_quota_on(struct super_block *sb, int type, int format_id) if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) return -EINVAL; - return dquot_enable(sb_dqopt(sb)->files[type], type, + return dquot_enable(dqopts(sb)->files[type], type, format_id, DQUOT_LIMITS_ENABLED); } diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index d1d1c51..748d744 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -346,7 +346,7 @@ int dquot_mark_dquot_dirty(struct dquot *dquot) spin_lock(&dq_list_lock); if (!test_and_set_bit(DQ_MOD_B, &dquot->dq_flags)) { - list_add(&dquot->dq_dirty, &sb_dqopt(dquot->dq_sb)-> + list_add(&dquot->dq_dirty, &sb_dqopts(dquot)-> info[dquot->dq_type].dqi_dirty_list); ret = 0; } @@ -390,7 +390,7 @@ static inline int clear_dquot_dirty(struct dquot *dquot) void mark_info_dirty(struct super_block *sb, int type) { - set_bit(DQF_INFO_DIRTY_B, &sb_dqopt(sb)->info[type].dqi_flags); + set_bit(DQF_INFO_DIRTY_B, &dqopts(sb)->info[type].dqi_flags); } EXPORT_SYMBOL(mark_info_dirty); @@ -401,7 +401,7 @@ EXPORT_SYMBOL(mark_info_dirty); int dquot_acquire(struct dquot *dquot) { int ret = 0, ret2 = 0; - struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); + struct quota_info *dqopt = sb_dqopts(dquot); mutex_lock(&dquot->dq_lock); mutex_lock(&dqopt->dqio_mutex); @@ -439,7 +439,7 @@ EXPORT_SYMBOL(dquot_acquire); int dquot_commit(struct dquot *dquot) { int ret = 0, ret2 = 0; - struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); + struct quota_info *dqopt = sb_dqopts(dquot); mutex_lock(&dqopt->dqio_mutex); spin_lock(&dq_list_lock); @@ -471,7 +471,7 @@ EXPORT_SYMBOL(dquot_commit); int dquot_release(struct dquot *dquot) { int ret = 0, ret2 = 0; - struct quota_info *dqopt = sb_dqopt(dquot->dq_sb); + struct quota_info *dqopt = sb_dqopts(dquot); mutex_lock(&dquot->dq_lock); /* Check whether we are not racing with some other dqget() */ @@ -568,7 +568,7 @@ int dquot_scan_active(struct super_block *sb, struct dquot *dquot, *old_dquot = NULL; int ret = 0; - mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_lock(&dqopts(sb)->dqonoff_mutex); spin_lock(&dq_list_lock); list_for_each_entry(dquot, &inuse_list, dq_inuse) { if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) @@ -591,7 +591,7 @@ int dquot_scan_active(struct super_block *sb, spin_unlock(&dq_list_lock); out: dqput(old_dquot); - mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_unlock(&dqopts(sb)->dqonoff_mutex); return ret; } EXPORT_SYMBOL(dquot_scan_active); @@ -600,7 +600,7 @@ int dquot_quota_sync(struct super_block *sb, int type, int wait) { struct list_head *dirty; struct dquot *dquot; - struct quota_info *dqopt = sb_dqopt(sb); + struct quota_info *dqopt = dqopts(sb); int cnt; mutex_lock(&dqopt->dqonoff_mutex); @@ -639,7 +639,7 @@ int dquot_quota_sync(struct super_block *sb, int type, int wait) dqstats_inc(DQST_SYNCS); mutex_unlock(&dqopt->dqonoff_mutex); - if (!wait || (sb_dqopt(sb)->flags & DQUOT_QUOTA_SYS_FILE)) + if (!wait || (dqopts(sb)->flags & DQUOT_QUOTA_SYS_FILE)) return 0; /* This is not very clever (and fast) but currently I don't know about @@ -653,18 +653,18 @@ int dquot_quota_sync(struct super_block *sb, int type, int wait) * Now when everything is written we can discard the pagecache so * that userspace sees the changes. */ - mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_lock(&dqopts(sb)->dqonoff_mutex); for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (type != -1 && cnt != type) continue; if (!sb_has_quota_active(sb, cnt)) continue; - mutex_lock_nested(&sb_dqopt(sb)->files[cnt]->i_mutex, + mutex_lock_nested(&dqopts(sb)->files[cnt]->i_mutex, I_MUTEX_QUOTA); - truncate_inode_pages(&sb_dqopt(sb)->files[cnt]->i_data, 0); - mutex_unlock(&sb_dqopt(sb)->files[cnt]->i_mutex); + truncate_inode_pages(&dqopts(sb)->files[cnt]->i_data, 0); + mutex_unlock(&dqopts(sb)->files[cnt]->i_mutex); } - mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_unlock(&dqopts(sb)->dqonoff_mutex); return 0; } @@ -1033,9 +1033,9 @@ static void drop_dquot_ref(struct super_block *sb, int type) LIST_HEAD(tofree_head); if (sb->dq_op) { - down_write(&sb_dqopt(sb)->dqptr_sem); + down_write(&dqopts(sb)->dqptr_sem); remove_dquot_ref(sb, type, &tofree_head); - up_write(&sb_dqopt(sb)->dqptr_sem); + up_write(&dqopts(sb)->dqptr_sem); put_dquot_list(&tofree_head); } } @@ -1081,7 +1081,7 @@ void dquot_free_reserved_space(struct dquot *dquot, qsize_t number) static void dquot_decr_inodes(struct dquot *dquot, qsize_t number) { - if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE || + if (sb_dqopts(dquot)->flags & DQUOT_NEGATIVE_USAGE || dquot->dq_dqb.dqb_curinodes >= number) dquot->dq_dqb.dqb_curinodes -= number; else @@ -1093,7 +1093,7 @@ static void dquot_decr_inodes(struct dquot *dquot, qsize_t number) static void dquot_decr_space(struct dquot *dquot, qsize_t number) { - if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE || + if (sb_dqopts(dquot)->flags & DQUOT_NEGATIVE_USAGE || dquot->dq_dqb.dqb_curspace >= number) dquot->dq_dqb.dqb_curspace -= number; else @@ -1203,7 +1203,7 @@ static void flush_warnings(struct dquot *const *dquots, char *warntype) static int ignore_hardlimit(struct dquot *dquot) { - struct mem_dqinfo *info = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_type]; + struct mem_dqinfo *info = &sb_dqopts(dquot)->info[dquot->dq_type]; return capable(CAP_SYS_RESOURCE) && (info->dqi_format->qf_fmt_id != QFMT_VFS_OLD || @@ -1241,7 +1241,7 @@ static int check_idq(struct dquot *dquot, qsize_t inodes, char *warntype) dquot->dq_dqb.dqb_itime == 0) { *warntype = QUOTA_NL_ISOFTWARN; dquot->dq_dqb.dqb_itime = get_seconds() + - sb_dqopt(dquot->dq_sb)->info[dquot->dq_type].dqi_igrace; + sb_dqopts(dquot)->info[dquot->dq_type].dqi_igrace; } return 0; @@ -1285,7 +1285,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war if (!prealloc) { *warntype = QUOTA_NL_BSOFTWARN; dquot->dq_dqb.dqb_btime = get_seconds() + - sb_dqopt(sb)->info[dquot->dq_type].dqi_bgrace; + dqopts(sb)->info[dquot->dq_type].dqi_bgrace; } else /* @@ -1377,7 +1377,7 @@ static void __dquot_initialize(struct inode *inode, int type) got[cnt] = dqget(sb, id, cnt); } - down_write(&sb_dqopt(sb)->dqptr_sem); + down_write(&dqopts(sb)->dqptr_sem); if (IS_NOQUOTA(inode)) goto out_err; for (cnt = 0; cnt < MAXQUOTAS; cnt++) { @@ -1402,7 +1402,7 @@ static void __dquot_initialize(struct inode *inode, int type) } } out_err: - up_write(&sb_dqopt(sb)->dqptr_sem); + up_write(&dqopts(sb)->dqptr_sem); /* Drop unused references */ dqput_all(got); } @@ -1421,12 +1421,12 @@ static void __dquot_drop(struct inode *inode) int cnt; struct dquot *put[MAXQUOTAS]; - down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); + down_write(&dqopts(inode->i_sb)->dqptr_sem); for (cnt = 0; cnt < MAXQUOTAS; cnt++) { put[cnt] = inode->i_dquot[cnt]; inode->i_dquot[cnt] = NULL; } - up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); + up_write(&dqopts(inode->i_sb)->dqptr_sem); dqput_all(put); } @@ -1550,7 +1550,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags) goto out; } - down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); + down_read(&dqopts(inode->i_sb)->dqptr_sem); for (cnt = 0; cnt < MAXQUOTAS; cnt++) warntype[cnt] = QUOTA_NL_NOWARN; @@ -1581,7 +1581,7 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags) mark_all_dquot_dirty(inode->i_dquot); out_flush_warn: flush_warnings(inode->i_dquot, warntype); - up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); + up_read(&dqopts(inode->i_sb)->dqptr_sem); out: return ret; } @@ -1601,7 +1601,7 @@ int dquot_alloc_inode(const struct inode *inode) return 0; for (cnt = 0; cnt < MAXQUOTAS; cnt++) warntype[cnt] = QUOTA_NL_NOWARN; - down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); + down_read(&dqopts(inode->i_sb)->dqptr_sem); spin_lock(&dq_data_lock); for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (!inode->i_dquot[cnt]) @@ -1622,7 +1622,7 @@ warn_put_all: if (ret == 0) mark_all_dquot_dirty(inode->i_dquot); flush_warnings(inode->i_dquot, warntype); - up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); + up_read(&dqopts(inode->i_sb)->dqptr_sem); return ret; } EXPORT_SYMBOL(dquot_alloc_inode); @@ -1639,7 +1639,7 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) return 0; } - down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); + down_read(&dqopts(inode->i_sb)->dqptr_sem); spin_lock(&dq_data_lock); /* Claim reserved quotas to allocated quotas */ for (cnt = 0; cnt < MAXQUOTAS; cnt++) { @@ -1651,7 +1651,7 @@ int dquot_claim_space_nodirty(struct inode *inode, qsize_t number) inode_claim_rsv_space(inode, number); spin_unlock(&dq_data_lock); mark_all_dquot_dirty(inode->i_dquot); - up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); + up_read(&dqopts(inode->i_sb)->dqptr_sem); return 0; } EXPORT_SYMBOL(dquot_claim_space_nodirty); @@ -1672,7 +1672,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags) return; } - down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); + down_read(&dqopts(inode->i_sb)->dqptr_sem); spin_lock(&dq_data_lock); for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (!inode->i_dquot[cnt]) @@ -1691,7 +1691,7 @@ void __dquot_free_space(struct inode *inode, qsize_t number, int flags) mark_all_dquot_dirty(inode->i_dquot); out_unlock: flush_warnings(inode->i_dquot, warntype); - up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); + up_read(&dqopts(inode->i_sb)->dqptr_sem); } EXPORT_SYMBOL(__dquot_free_space); @@ -1708,7 +1708,7 @@ void dquot_free_inode(const struct inode *inode) if (!dquot_active(inode)) return; - down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); + down_read(&dqopts(inode->i_sb)->dqptr_sem); spin_lock(&dq_data_lock); for (cnt = 0; cnt < MAXQUOTAS; cnt++) { if (!inode->i_dquot[cnt]) @@ -1719,7 +1719,7 @@ void dquot_free_inode(const struct inode *inode) spin_unlock(&dq_data_lock); mark_all_dquot_dirty(inode->i_dquot); flush_warnings(inode->i_dquot, warntype); - up_read(&sb_dqopt(inode->i_sb)->dqptr_sem); + up_read(&dqopts(inode->i_sb)->dqptr_sem); } EXPORT_SYMBOL(dquot_free_inode); @@ -1750,9 +1750,9 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) /* Initialize the arrays */ for (cnt = 0; cnt < MAXQUOTAS; cnt++) warntype_to[cnt] = QUOTA_NL_NOWARN; - down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); + down_write(&dqopts(inode->i_sb)->dqptr_sem); if (IS_NOQUOTA(inode)) { /* File without quota accounting? */ - up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); + up_write(&dqopts(inode->i_sb)->dqptr_sem); return 0; } spin_lock(&dq_data_lock); @@ -1804,7 +1804,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) inode->i_dquot[cnt] = transfer_to[cnt]; } spin_unlock(&dq_data_lock); - up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); + up_write(&dqopts(inode->i_sb)->dqptr_sem); mark_all_dquot_dirty(transfer_from); mark_all_dquot_dirty(transfer_to); @@ -1818,7 +1818,7 @@ int __dquot_transfer(struct inode *inode, struct dquot **transfer_to) return 0; over_quota: spin_unlock(&dq_data_lock); - up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); + up_write(&dqopts(inode->i_sb)->dqptr_sem); flush_warnings(transfer_to, warntype_to); return ret; } @@ -1853,7 +1853,7 @@ EXPORT_SYMBOL(dquot_transfer); int dquot_commit_info(struct super_block *sb, int type) { int ret; - struct quota_info *dqopt = sb_dqopt(sb); + struct quota_info *dqopt = dqopts(sb); mutex_lock(&dqopt->dqio_mutex); ret = dqopt->ops[type]->write_file_info(sb, type); @@ -1892,13 +1892,13 @@ EXPORT_SYMBOL(dquot_file_open); int dquot_get_dqfmt(struct super_block *sb, int type, unsigned int *fmt) { - mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_lock(&dqopts(sb)->dqonoff_mutex); if (!sb_has_quota_active(sb, type)) { - mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_unlock(&dqopts(sb)->dqonoff_mutex); return -ESRCH; } - *fmt = sb_dqopt(sb)->info[type].dqi_format->qf_fmt_id; - mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); + *fmt = dqopts(sb)->info[type].dqi_format->qf_fmt_id; + mutex_unlock(&dqopts(sb)->dqonoff_mutex); return 0; } EXPORT_SYMBOL(dquot_get_dqfmt); @@ -1909,7 +1909,7 @@ EXPORT_SYMBOL(dquot_get_dqfmt); int dquot_disable(struct super_block *sb, int type, unsigned int flags) { int cnt, ret = 0; - struct quota_info *dqopt = sb_dqopt(sb); + struct quota_info *dqopt = dqopts(sb); struct inode *toputinode[MAXQUOTAS]; /* Cannot turn off usage accounting without turning off limits, or @@ -2058,7 +2058,7 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, { struct quota_format_type *fmt = find_quota_format(format_id); struct super_block *sb = inode->i_sb; - struct quota_info *dqopt = sb_dqopt(sb); + struct quota_info *dqopt = dqopts(sb); int error; int oldflags = -1; @@ -2164,7 +2164,7 @@ out_fmt: /* Reenable quotas on remount RW */ int dquot_resume(struct super_block *sb, int type) { - struct quota_info *dqopt = sb_dqopt(sb); + struct quota_info *dqopt = dqopts(sb); struct inode *inode; int ret = 0, cnt; unsigned int flags; @@ -2224,7 +2224,7 @@ int dquot_enable(struct inode *inode, int type, int format_id, { int ret = 0; struct super_block *sb = inode->i_sb; - struct quota_info *dqopt = sb_dqopt(sb); + struct quota_info *dqopt = dqopts(sb); /* Just unsuspend quotas? */ BUG_ON(flags & DQUOT_SUSPENDED); @@ -2250,7 +2250,7 @@ int dquot_enable(struct inode *inode, int type, int format_id, goto out_lock; } spin_lock(&dq_state_lock); - sb_dqopt(sb)->flags |= dquot_state_flag(flags, type); + dqopts(sb)->flags |= dquot_state_flag(flags, type); spin_unlock(&dq_state_lock); out_lock: mutex_unlock(&dqopt->dqonoff_mutex); @@ -2352,7 +2352,7 @@ static int do_set_dqblk(struct dquot *dquot, struct fs_disk_quota *di) { struct mem_dqblk *dm = &dquot->dq_dqb; int check_blim = 0, check_ilim = 0; - struct mem_dqinfo *dqi = &sb_dqopt(dquot->dq_sb)->info[dquot->dq_type]; + struct mem_dqinfo *dqi = &sb_dqopts(dquot)->info[dquot->dq_type]; if (di->d_fieldmask & ~VFS_FS_DQ_MASK) return -EINVAL; @@ -2462,19 +2462,19 @@ int dquot_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii) { struct mem_dqinfo *mi; - mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_lock(&dqopts(sb)->dqonoff_mutex); if (!sb_has_quota_active(sb, type)) { - mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_unlock(&dqopts(sb)->dqonoff_mutex); return -ESRCH; } - mi = sb_dqopt(sb)->info + type; + mi = dqopts(sb)->info + type; spin_lock(&dq_data_lock); ii->dqi_bgrace = mi->dqi_bgrace; ii->dqi_igrace = mi->dqi_igrace; ii->dqi_flags = mi->dqi_flags & DQF_MASK; ii->dqi_valid = IIF_ALL; spin_unlock(&dq_data_lock); - mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_unlock(&dqopts(sb)->dqonoff_mutex); return 0; } EXPORT_SYMBOL(dquot_get_dqinfo); @@ -2485,12 +2485,12 @@ int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii) struct mem_dqinfo *mi; int err = 0; - mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_lock(&dqopts(sb)->dqonoff_mutex); if (!sb_has_quota_active(sb, type)) { err = -ESRCH; goto out; } - mi = sb_dqopt(sb)->info + type; + mi = dqopts(sb)->info + type; spin_lock(&dq_data_lock); if (ii->dqi_valid & IIF_BGRACE) mi->dqi_bgrace = ii->dqi_bgrace; @@ -2504,7 +2504,7 @@ int dquot_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii) /* Force write to disk */ sb->dq_op->write_info(sb, type); out: - mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); + mutex_unlock(&dqopts(sb)->dqonoff_mutex); return err; } EXPORT_SYMBOL(dquot_set_dqinfo); diff --git a/fs/quota/quota_tree.c b/fs/quota/quota_tree.c index 9e48874..c0917f4 100644 --- a/fs/quota/quota_tree.c +++ b/fs/quota/quota_tree.c @@ -596,7 +596,7 @@ int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot) #ifdef __QUOTA_QT_PARANOIA /* Invalidated quota? */ - if (!sb_dqopt(dquot->dq_sb)->files[type]) { + if (!sb_dqopts(dquot)->files[type]) { quota_error(sb, "Quota invalidated while reading!"); return -EIO; } diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c index 34b37a6..cab3ca3 100644 --- a/fs/quota/quota_v1.c +++ b/fs/quota/quota_v1.c @@ -57,7 +57,7 @@ static int v1_read_dqblk(struct dquot *dquot) int type = dquot->dq_type; struct v1_disk_dqblk dqblk; - if (!sb_dqopt(dquot->dq_sb)->files[type]) + if (!sb_dqopts(dquot)->files[type]) return -EINVAL; /* Set structure to 0s in case read fails/is after end of file */ @@ -85,12 +85,12 @@ static int v1_commit_dqblk(struct dquot *dquot) v1_mem2disk_dqblk(&dqblk, &dquot->dq_dqb); if (dquot->dq_id == 0) { dqblk.dqb_btime = - sb_dqopt(dquot->dq_sb)->info[type].dqi_bgrace; + sb_dqopts(dquot)->info[type].dqi_bgrace; dqblk.dqb_itime = - sb_dqopt(dquot->dq_sb)->info[type].dqi_igrace; + sb_dqopts(dquot)->info[type].dqi_igrace; } ret = 0; - if (sb_dqopt(dquot->dq_sb)->files[type]) + if (sb_dqopts(dquot)->files[type]) ret = dquot->dq_sb->s_op->quota_write(dquot->dq_sb, type, (char *)&dqblk, sizeof(struct v1_disk_dqblk), v1_dqoff(dquot->dq_id)); @@ -122,7 +122,7 @@ struct v2_disk_dqheader { static int v1_check_quota_file(struct super_block *sb, int type) { - struct inode *inode = sb_dqopt(sb)->files[type]; + struct inode *inode = dqopts(sb)->files[type]; ulong blocks; size_t off; struct v2_disk_dqheader dqhead; @@ -154,7 +154,7 @@ static int v1_check_quota_file(struct super_block *sb, int type) static int v1_read_file_info(struct super_block *sb, int type) { - struct quota_info *dqopt = sb_dqopt(sb); + struct quota_info *dqopt = dqopts(sb); struct v1_disk_dqblk dqblk; int ret; @@ -179,7 +179,7 @@ out: static int v1_write_file_info(struct super_block *sb, int type) { - struct quota_info *dqopt = sb_dqopt(sb); + struct quota_info *dqopt = dqopts(sb); struct v1_disk_dqblk dqblk; int ret; diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index d4d32df..a07f30a 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c @@ -312,7 +312,7 @@ static int finish_unfinished(struct super_block *s) #ifdef CONFIG_QUOTA /* Turn quotas off */ for (i = 0; i < MAXQUOTAS; i++) { - if (sb_dqopt(s)->files[i] && quota_enabled[i]) + if (dqopts(s)->files[i] && quota_enabled[i]) dquot_quota_off(s, i); } if (ms_active_set) @@ -2106,7 +2106,7 @@ out: static ssize_t reiserfs_quota_read(struct super_block *sb, int type, char *data, size_t len, loff_t off) { - struct inode *inode = sb_dqopt(sb)->files[type]; + struct inode *inode = dqopts(sb)->files[type]; unsigned long blk = off >> sb->s_blocksize_bits; int err = 0, offset = off & (sb->s_blocksize - 1), tocopy; size_t toread; @@ -2151,7 +2151,7 @@ static ssize_t reiserfs_quota_read(struct super_block *sb, int type, char *data, static ssize_t reiserfs_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off) { - struct inode *inode = sb_dqopt(sb)->files[type]; + struct inode *inode = dqopts(sb)->files[type]; unsigned long blk = off >> sb->s_blocksize_bits; int err = 0, offset = off & (sb->s_blocksize - 1), tocopy; int journal_quota = REISERFS_SB(sb)->s_qf_names[type] != NULL; diff --git a/include/linux/quota.h b/include/linux/quota.h index 2767e4c..bc495d0 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -182,6 +182,7 @@ enum { #include <asm/atomic.h> + typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ typedef long long qsize_t; /* Type in which we store sizes */ diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 45ae255..9750d86 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h @@ -13,10 +13,14 @@ #define DQUOT_SPACE_RESERVE 0x2 #define DQUOT_SPACE_NOFAIL 0x4 -static inline struct quota_info *sb_dqopt(struct super_block *sb) +static inline struct quota_info *dqopts(struct super_block *sb) { return &sb->s_dquot; } +static inline struct quota_info* sb_dqopts(struct dquot *dq) +{ + return dqopts(dq->dq_sb); +} /* i_mutex must being held */ static inline bool is_quota_modification(struct inode *inode, struct iattr *ia) @@ -96,7 +100,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr); static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) { - return sb_dqopt(sb)->info + type; + return dqopts(sb)->info + type; } /* @@ -105,19 +109,19 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type) static inline bool sb_has_quota_usage_enabled(struct super_block *sb, int type) { - return sb_dqopt(sb)->flags & + return dqopts(sb)->flags & dquot_state_flag(DQUOT_USAGE_ENABLED, type); } static inline bool sb_has_quota_limits_enabled(struct super_block *sb, int type) { - return sb_dqopt(sb)->flags & + return dqopts(sb)->flags & dquot_state_flag(DQUOT_LIMITS_ENABLED, type); } static inline bool sb_has_quota_suspended(struct super_block *sb, int type) { - return sb_dqopt(sb)->flags & + return dqopts(sb)->flags & dquot_state_flag(DQUOT_SUSPENDED, type); } -- 1.6.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html