Lines Matching refs:sb
28 static inline unsigned int ol_quota_entries_per_block(struct super_block *sb) in ol_quota_entries_per_block() argument
30 return ((sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE) / in ol_quota_entries_per_block()
35 static inline unsigned int ol_chunk_blocks(struct super_block *sb) in ol_chunk_blocks() argument
37 return ((sb->s_blocksize - sizeof(struct ocfs2_local_disk_chunk) - in ol_chunk_blocks()
39 ol_quota_entries_per_block(sb); in ol_chunk_blocks()
43 static unsigned int ol_chunk_entries(struct super_block *sb) in ol_chunk_entries() argument
45 return ol_chunk_blocks(sb) * ol_quota_entries_per_block(sb); in ol_chunk_entries()
49 static unsigned int ol_quota_chunk_block(struct super_block *sb, int c) in ol_quota_chunk_block() argument
52 return 1 + (ol_chunk_blocks(sb) + 1) * c; in ol_quota_chunk_block()
55 static unsigned int ol_dqblk_block(struct super_block *sb, int c, int off) in ol_dqblk_block() argument
57 int epb = ol_quota_entries_per_block(sb); in ol_dqblk_block()
59 return ol_quota_chunk_block(sb, c) + 1 + off / epb; in ol_dqblk_block()
62 static unsigned int ol_dqblk_block_off(struct super_block *sb, int c, int off) in ol_dqblk_block_off() argument
64 int epb = ol_quota_entries_per_block(sb); in ol_dqblk_block_off()
70 static loff_t ol_dqblk_off(struct super_block *sb, int c, int off) in ol_dqblk_off() argument
72 return (ol_dqblk_block(sb, c, off) << sb->s_blocksize_bits) + in ol_dqblk_off()
73 ol_dqblk_block_off(sb, c, off); in ol_dqblk_off()
76 static inline unsigned int ol_dqblk_block_offset(struct super_block *sb, loff_t off) in ol_dqblk_block_offset() argument
78 return off & ((1 << sb->s_blocksize_bits) - 1); in ol_dqblk_block_offset()
82 static int ol_dqblk_chunk_off(struct super_block *sb, int c, loff_t off) in ol_dqblk_chunk_off() argument
84 int epb = ol_quota_entries_per_block(sb); in ol_dqblk_chunk_off()
86 return ((off >> sb->s_blocksize_bits) - in ol_dqblk_chunk_off()
87 ol_quota_chunk_block(sb, c) - 1) * epb in ol_dqblk_chunk_off()
88 + ((unsigned int)(off & ((1 << sb->s_blocksize_bits) - 1))) / in ol_dqblk_chunk_off()
96 struct super_block *sb = inode->i_sb; in ocfs2_modify_bh() local
100 handle = ocfs2_start_trans(OCFS2_SB(sb), in ocfs2_modify_bh()
111 ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_modify_bh()
119 status = ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_modify_bh()
160 static int ocfs2_local_check_quota_file(struct super_block *sb, int type) in ocfs2_local_check_quota_file() argument
169 struct inode *linode = sb_dqopt(sb)->files[type]; in ocfs2_local_check_quota_file()
199 ginode = ocfs2_get_system_file_inode(OCFS2_SB(sb), ino[type], in ocfs2_local_check_quota_file()
294 static int ocfs2_add_recovery_chunk(struct super_block *sb, in ocfs2_add_recovery_chunk() argument
305 rc->rc_bitmap = kmalloc(sb->s_blocksize, GFP_NOFS); in ocfs2_add_recovery_chunk()
311 (ol_chunk_entries(sb) + 7) >> 3); in ocfs2_add_recovery_chunk()
343 struct super_block *sb = lqinode->i_sb; in ocfs2_recovery_load_quota() local
352 ol_quota_chunk_block(sb, i), in ocfs2_recovery_load_quota()
359 if (le32_to_cpu(dchunk->dqc_free) < ol_chunk_entries(sb)) in ocfs2_recovery_load_quota()
360 status = ocfs2_add_recovery_chunk(sb, dchunk, i, head); in ocfs2_recovery_load_quota()
393 struct super_block *sb = osb->sb; in ocfs2_begin_quota_recovery() local
410 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) in ocfs2_begin_quota_recovery()
462 struct super_block *sb = lqinode->i_sb; in ocfs2_recover_local_quota_file() local
463 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; in ocfs2_recover_local_quota_file()
480 ol_quota_chunk_block(sb, chunk), in ocfs2_recover_local_quota_file()
487 for_each_set_bit(bit, rchunk->rc_bitmap, ol_chunk_entries(sb)) { in ocfs2_recover_local_quota_file()
490 ol_dqblk_block(sb, chunk, bit), in ocfs2_recover_local_quota_file()
497 ol_dqblk_block_off(sb, chunk, bit)); in ocfs2_recover_local_quota_file()
498 dquot = dqget(sb, in ocfs2_recover_local_quota_file()
516 handle = ocfs2_start_trans(OCFS2_SB(sb), in ocfs2_recover_local_quota_file()
523 mutex_lock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_recover_local_quota_file()
556 mutex_unlock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_recover_local_quota_file()
557 ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_recover_local_quota_file()
588 struct super_block *sb = osb->sb; in ocfs2_finish_quota_recovery() local
600 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); in ocfs2_finish_quota_recovery()
677 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); in ocfs2_finish_quota_recovery()
683 static int ocfs2_local_read_info(struct super_block *sb, int type) in ocfs2_local_read_info() argument
686 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_local_read_info()
688 struct inode *lqinode = sb_dqopt(sb)->files[type]; in ocfs2_local_read_info()
696 mutex_unlock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_local_read_info()
712 status = ocfs2_global_read_info(sb, type); in ocfs2_local_read_info()
740 rec = OCFS2_SB(sb)->quota_rec; in ocfs2_local_read_info()
748 OCFS2_SB(sb)->quota_rec = rec; in ocfs2_local_read_info()
775 mutex_lock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_local_read_info()
780 ocfs2_simple_drop_lockres(OCFS2_SB(sb), &oinfo->dqi_gqlock); in ocfs2_local_read_info()
789 mutex_lock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_local_read_info()
794 static int ocfs2_local_write_info(struct super_block *sb, int type) in ocfs2_local_write_info() argument
796 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_local_write_info()
801 status = ocfs2_modify_bh(sb_dqopt(sb)->files[type], bh, olq_update_info, in ocfs2_local_write_info()
812 static int ocfs2_local_free_info(struct super_block *sb, int type) in ocfs2_local_free_info() argument
814 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_local_free_info()
822 ocfs2_simple_drop_lockres(OCFS2_SB(sb), &oinfo->dqi_gqlock); in ocfs2_local_free_info()
828 len = ol_chunk_entries(sb); in ocfs2_local_free_info()
831 ol_quota_chunk_block(sb, chunk->qc_num) - 1) in ocfs2_local_free_info()
832 * ol_quota_entries_per_block(sb); in ocfs2_local_free_info()
854 status = ocfs2_modify_bh(sb_dqopt(sb)->files[type], in ocfs2_local_free_info()
864 ocfs2_inode_unlock(sb_dqopt(sb)->files[type], 1); in ocfs2_local_free_info()
875 struct super_block *sb = od->dq_dquot.dq_sb; in olq_set_dquot() local
878 + ol_dqblk_block_offset(sb, od->dq_local_off)); in olq_set_dquot()
897 struct super_block *sb = dquot->dq_sb; in ocfs2_local_write_dquot() local
900 struct inode *lqinode = sb_dqopt(sb)->files[dquot->dq_id.type]; in ocfs2_local_write_dquot()
920 static struct ocfs2_quota_chunk *ocfs2_find_free_entry(struct super_block *sb, in ocfs2_find_free_entry() argument
924 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_find_free_entry()
942 len = ol_chunk_entries(sb); in ocfs2_find_free_entry()
945 ol_quota_chunk_block(sb, chunk->qc_num) - 1) in ocfs2_find_free_entry()
946 * ol_quota_entries_per_block(sb); in ocfs2_find_free_entry()
963 struct super_block *sb, in ocfs2_local_quota_add_chunk() argument
967 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_local_quota_add_chunk()
969 struct inode *lqinode = sb_dqopt(sb)->files[type]; in ocfs2_local_quota_add_chunk()
979 i_size_read(lqinode) + 2 * sb->s_blocksize, in ocfs2_local_quota_add_chunk()
986 i_size_read(lqinode) + 2 * sb->s_blocksize); in ocfs2_local_quota_add_chunk()
999 handle = ocfs2_start_trans(OCFS2_SB(sb), in ocfs2_local_quota_add_chunk()
1015 bh = sb_getblk(sb, p_blkno); in ocfs2_local_quota_add_chunk()
1030 dchunk->dqc_free = cpu_to_le32(ol_quota_entries_per_block(sb)); in ocfs2_local_quota_add_chunk()
1032 sb->s_blocksize - sizeof(struct ocfs2_local_disk_chunk) - in ocfs2_local_quota_add_chunk()
1044 dbh = sb_getblk(sb, p_blkno); in ocfs2_local_quota_add_chunk()
1058 memset(dbh->b_data, 0, sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE); in ocfs2_local_quota_add_chunk()
1065 status = ocfs2_local_write_info(sb, type); in ocfs2_local_quota_add_chunk()
1070 status = ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_local_quota_add_chunk()
1084 ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_local_quota_add_chunk()
1094 struct super_block *sb, in ocfs2_extend_local_quota_file() argument
1098 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_extend_local_quota_file()
1101 struct inode *lqinode = sb_dqopt(sb)->files[type]; in ocfs2_extend_local_quota_file()
1103 int epb = ol_quota_entries_per_block(sb); in ocfs2_extend_local_quota_file()
1111 return ocfs2_local_quota_add_chunk(sb, type, offset); in ocfs2_extend_local_quota_file()
1116 ol_quota_chunk_block(sb, chunk->qc_num) - 1; in ocfs2_extend_local_quota_file()
1117 if (ol_chunk_blocks(sb) == chunk_blocks) in ocfs2_extend_local_quota_file()
1118 return ocfs2_local_quota_add_chunk(sb, type, offset); in ocfs2_extend_local_quota_file()
1122 i_size_read(lqinode) + sb->s_blocksize, in ocfs2_extend_local_quota_file()
1129 i_size_read(lqinode) + sb->s_blocksize); in ocfs2_extend_local_quota_file()
1142 bh = sb_getblk(sb, p_blkno); in ocfs2_extend_local_quota_file()
1151 handle = ocfs2_start_trans(OCFS2_SB(sb), in ocfs2_extend_local_quota_file()
1167 memset(bh->b_data, 0, sb->s_blocksize); in ocfs2_extend_local_quota_file()
1182 le32_add_cpu(&dchunk->dqc_free, ol_quota_entries_per_block(sb)); in ocfs2_extend_local_quota_file()
1188 status = ocfs2_local_write_info(sb, type); in ocfs2_extend_local_quota_file()
1194 status = ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_extend_local_quota_file()
1202 ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_extend_local_quota_file()
1220 struct super_block *sb = dquot->dq_sb; in ocfs2_create_local_dquot() local
1222 struct inode *lqinode = sb_dqopt(sb)->files[type]; in ocfs2_create_local_dquot()
1230 chunk = ocfs2_find_free_entry(sb, type, &offset); in ocfs2_create_local_dquot()
1232 chunk = ocfs2_extend_local_quota_file(sb, type, &offset); in ocfs2_create_local_dquot()
1241 od->dq_local_off = ol_dqblk_off(sb, chunk->qc_num, offset); in ocfs2_create_local_dquot()
1244 ol_dqblk_block(sb, chunk->qc_num, offset), in ocfs2_create_local_dquot()
1277 struct super_block *sb = dquot->dq_sb; in ocfs2_local_release_dquot() local
1282 INODE_CACHE(sb_dqopt(sb)->files[type]), in ocfs2_local_release_dquot()
1288 offset = ol_dqblk_chunk_off(sb, od->dq_chunk->qc_num, in ocfs2_local_release_dquot()