Lines Matching refs:sb
132 void __quota_error(struct super_block *sb, const char *func, in __quota_error() argument
145 sb->s_id, func, &vaf); in __quota_error()
253 hashfn(const struct super_block *sb, struct kqid qid) in hashfn() argument
259 tmp = (((unsigned long)sb>>L1_CACHE_SHIFT) ^ id) * (MAXQUOTAS - type); in hashfn()
278 static struct dquot *find_dquot(unsigned int hashent, struct super_block *sb, in find_dquot() argument
286 if (dquot->dq_sb == sb && qid_eq(dquot->dq_id, qid)) in find_dquot()
393 void mark_info_dirty(struct super_block *sb, int type) in mark_info_dirty() argument
395 set_bit(DQF_INFO_DIRTY_B, &sb_dqopt(sb)->info[type].dqi_flags); in mark_info_dirty()
513 static void invalidate_dquots(struct super_block *sb, int type) in invalidate_dquots() argument
520 if (dquot->dq_sb != sb) in invalidate_dquots()
561 int dquot_scan_active(struct super_block *sb, in dquot_scan_active() argument
568 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); in dquot_scan_active()
573 if (dquot->dq_sb != sb) in dquot_scan_active()
599 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); in dquot_scan_active()
605 int dquot_writeback_dquots(struct super_block *sb, int type) in dquot_writeback_dquots() argument
609 struct quota_info *dqopt = sb_dqopt(sb); in dquot_writeback_dquots()
617 if (!sb_has_quota_active(sb, cnt)) in dquot_writeback_dquots()
635 err = sb->dq_op->write_dquot(dquot); in dquot_writeback_dquots()
645 if ((cnt == type || type == -1) && sb_has_quota_active(sb, cnt) in dquot_writeback_dquots()
647 sb->dq_op->write_info(sb, cnt); in dquot_writeback_dquots()
656 int dquot_quota_sync(struct super_block *sb, int type) in dquot_quota_sync() argument
658 struct quota_info *dqopt = sb_dqopt(sb); in dquot_quota_sync()
662 ret = dquot_writeback_dquots(sb, type); in dquot_quota_sync()
671 if (sb->s_op->sync_fs) in dquot_quota_sync()
672 sb->s_op->sync_fs(sb, 1); in dquot_quota_sync()
673 sync_blockdev(sb->s_bdev); in dquot_quota_sync()
683 if (!sb_has_quota_active(sb, cnt)) in dquot_quota_sync()
797 struct dquot *dquot_alloc(struct super_block *sb, int type) in dquot_alloc() argument
803 static struct dquot *get_empty_dquot(struct super_block *sb, int type) in get_empty_dquot() argument
807 dquot = sb->dq_op->alloc_dquot(sb, type); in get_empty_dquot()
817 dquot->dq_sb = sb; in get_empty_dquot()
832 struct dquot *dqget(struct super_block *sb, struct kqid qid) in dqget() argument
834 unsigned int hashent = hashfn(sb, qid); in dqget()
837 if (!sb_has_quota_active(sb, qid.type)) in dqget()
842 if (!sb_has_quota_active(sb, qid.type)) { in dqget()
850 dquot = find_dquot(hashent, sb, qid); in dqget()
854 empty = get_empty_dquot(sb, qid.type); in dqget()
883 err = sb->dq_op->acquire_dquot(dquot); in dqget()
924 static void add_dquot_ref(struct super_block *sb, int type) in add_dquot_ref() argument
931 spin_lock(&sb->s_inode_list_lock); in add_dquot_ref()
932 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { in add_dquot_ref()
942 spin_unlock(&sb->s_inode_list_lock); in add_dquot_ref()
960 spin_lock(&sb->s_inode_list_lock); in add_dquot_ref()
962 spin_unlock(&sb->s_inode_list_lock); in add_dquot_ref()
967 quota_error(sb, "Writes happened before quota was turned on " in add_dquot_ref()
1025 static void remove_dquot_ref(struct super_block *sb, int type, in remove_dquot_ref() argument
1031 spin_lock(&sb->s_inode_list_lock); in remove_dquot_ref()
1032 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { in remove_dquot_ref()
1047 spin_unlock(&sb->s_inode_list_lock); in remove_dquot_ref()
1052 "inconsistent. Please run quotacheck(8).\n", sb->s_id); in remove_dquot_ref()
1058 static void drop_dquot_ref(struct super_block *sb, int type) in drop_dquot_ref() argument
1062 if (sb->dq_op) { in drop_dquot_ref()
1063 remove_dquot_ref(sb, type, &tofree_head); in drop_dquot_ref()
1305 struct super_block *sb = dquot->dq_sb; in check_bdq() local
1307 if (!sb_has_quota_limits_enabled(sb, dquot->dq_id.type) || in check_bdq()
1338 sb_dqopt(sb)->info[dquot->dq_id.type].dqi_bgrace; in check_bdq()
1385 struct super_block *sb = inode->i_sb; in dquot_active() local
1389 return sb_any_quota_loaded(sb) & ~sb_any_quota_suspended(sb); in dquot_active()
1402 struct super_block *sb = inode->i_sb; in __dquot_initialize() local
1428 if (!sb_has_quota_active(sb, cnt)) in __dquot_initialize()
1447 dquot = dqget(sb, qid); in __dquot_initialize()
1470 if (!sb_has_quota_active(sb, cnt)) in __dquot_initialize()
1983 struct super_block *sb = inode->i_sb; in dquot_transfer() local
1990 dquot = dqget(sb, make_kqid_uid(iattr->ia_uid)); in dquot_transfer()
2001 dquot = dqget(sb, make_kqid_gid(iattr->ia_gid)); in dquot_transfer()
2021 int dquot_commit_info(struct super_block *sb, int type) in dquot_commit_info() argument
2024 struct quota_info *dqopt = sb_dqopt(sb); in dquot_commit_info()
2027 ret = dqopt->ops[type]->write_file_info(sb, type); in dquot_commit_info()
2064 int dquot_disable(struct super_block *sb, int type, unsigned int flags) in dquot_disable() argument
2067 struct quota_info *dqopt = sb_dqopt(sb); in dquot_disable()
2085 if (!sb_any_quota_loaded(sb)) { in dquot_disable()
2093 if (!sb_has_quota_loaded(sb, cnt)) in dquot_disable()
2105 if (!sb_has_quota_loaded(sb, cnt) && in dquot_disable()
2106 sb_has_quota_suspended(sb, cnt)) { in dquot_disable()
2118 if (sb_has_quota_loaded(sb, cnt) && !(flags & DQUOT_SUSPENDED)) in dquot_disable()
2122 drop_dquot_ref(sb, cnt); in dquot_disable()
2123 invalidate_dquots(sb, cnt); in dquot_disable()
2129 sb->dq_op->write_info(sb, cnt); in dquot_disable()
2131 dqopt->ops[cnt]->free_file_info(sb, cnt); in dquot_disable()
2135 if (!sb_has_quota_loaded(sb, cnt)) in dquot_disable()
2150 if (sb->s_op->sync_fs) in dquot_disable()
2151 sb->s_op->sync_fs(sb, 1); in dquot_disable()
2152 sync_blockdev(sb->s_bdev); in dquot_disable()
2163 if (!sb_has_quota_loaded(sb, cnt)) { in dquot_disable()
2174 if (sb->s_bdev) in dquot_disable()
2175 invalidate_bdev(sb->s_bdev); in dquot_disable()
2195 int dquot_quota_off(struct super_block *sb, int type) in dquot_quota_off() argument
2197 return dquot_disable(sb, type, in dquot_quota_off()
2214 struct super_block *sb = inode->i_sb; in vfs_load_quota_inode() local
2215 struct quota_info *dqopt = sb_dqopt(sb); in vfs_load_quota_inode()
2229 if (!sb->s_op->quota_write || !sb->s_op->quota_read || in vfs_load_quota_inode()
2230 (type == PRJQUOTA && sb->dq_op->get_projid == NULL)) { in vfs_load_quota_inode()
2247 sync_filesystem(sb); in vfs_load_quota_inode()
2248 invalidate_bdev(sb->s_bdev); in vfs_load_quota_inode()
2251 if (sb_has_quota_loaded(sb, type)) { in vfs_load_quota_inode()
2277 if (!fmt->qf_ops->check_quota_file(sb, type)) in vfs_load_quota_inode()
2285 error = dqopt->ops[type]->read_file_info(sb, type); in vfs_load_quota_inode()
2297 add_dquot_ref(sb, type); in vfs_load_quota_inode()
2322 int dquot_resume(struct super_block *sb, int type) in dquot_resume() argument
2324 struct quota_info *dqopt = sb_dqopt(sb); in dquot_resume()
2334 if (!sb_has_quota_suspended(sb, cnt)) { in dquot_resume()
2358 int dquot_quota_on(struct super_block *sb, int type, int format_id, in dquot_quota_on() argument
2365 if (path->dentry->d_sb != sb) in dquot_quota_on()
2383 struct super_block *sb = inode->i_sb; in dquot_enable() local
2384 struct quota_info *dqopt = sb_dqopt(sb); in dquot_enable()
2392 if (sb_has_quota_loaded(sb, type)) { in dquot_enable()
2395 if (!sb_has_quota_loaded(sb, type)) { in dquot_enable()
2400 sb_has_quota_usage_enabled(sb, type)) { in dquot_enable()
2405 sb_has_quota_limits_enabled(sb, type)) { in dquot_enable()
2410 sb_dqopt(sb)->flags |= dquot_state_flag(flags, type); in dquot_enable()
2426 int dquot_quota_on_mount(struct super_block *sb, char *qf_name, in dquot_quota_on_mount() argument
2432 mutex_lock(&d_inode(sb->s_root)->i_mutex); in dquot_quota_on_mount()
2433 dentry = lookup_one_len(qf_name, sb->s_root, strlen(qf_name)); in dquot_quota_on_mount()
2434 mutex_unlock(&d_inode(sb->s_root)->i_mutex); in dquot_quota_on_mount()
2454 static int dquot_quota_enable(struct super_block *sb, unsigned int flags) in dquot_quota_enable() argument
2458 struct quota_info *dqopt = sb_dqopt(sb); in dquot_quota_enable()
2470 if (!sb_has_quota_usage_enabled(sb, type)) in dquot_quota_enable()
2483 dquot_disable(sb, type, DQUOT_LIMITS_ENABLED); in dquot_quota_enable()
2491 static int dquot_quota_disable(struct super_block *sb, unsigned int flags) in dquot_quota_disable() argument
2495 struct quota_info *dqopt = sb_dqopt(sb); in dquot_quota_disable()
2510 if (!sb_has_quota_limits_enabled(sb, type)) in dquot_quota_disable()
2517 ret = dquot_disable(sb, type, DQUOT_LIMITS_ENABLED); in dquot_quota_disable()
2552 int dquot_get_dqblk(struct super_block *sb, struct kqid qid, in dquot_get_dqblk() argument
2557 dquot = dqget(sb, qid); in dquot_get_dqblk()
2664 int dquot_set_dqblk(struct super_block *sb, struct kqid qid, in dquot_set_dqblk() argument
2670 dquot = dqget(sb, qid); in dquot_set_dqblk()
2683 int dquot_get_state(struct super_block *sb, struct qc_state *state) in dquot_get_state() argument
2687 struct quota_info *dqopt = sb_dqopt(sb); in dquot_get_state()
2690 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); in dquot_get_state()
2693 if (!sb_has_quota_active(sb, type)) in dquot_get_state()
2696 mi = sb_dqopt(sb)->info + type; in dquot_get_state()
2703 if (sb_has_quota_limits_enabled(sb, type)) in dquot_get_state()
2712 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); in dquot_get_state()
2718 int dquot_set_dqinfo(struct super_block *sb, int type, struct qc_info *ii) in dquot_set_dqinfo() argument
2726 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); in dquot_set_dqinfo()
2727 if (!sb_has_quota_active(sb, type)) { in dquot_set_dqinfo()
2731 mi = sb_dqopt(sb)->info + type; in dquot_set_dqinfo()
2751 mark_info_dirty(sb, type); in dquot_set_dqinfo()
2753 sb->dq_op->write_info(sb, type); in dquot_set_dqinfo()
2755 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); in dquot_set_dqinfo()