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()
161 static int ocfs2_local_check_quota_file(struct super_block *sb, int type) in ocfs2_local_check_quota_file() argument
170 struct inode *linode = sb_dqopt(sb)->files[type]; in ocfs2_local_check_quota_file()
200 ginode = ocfs2_get_system_file_inode(OCFS2_SB(sb), ino[type], in ocfs2_local_check_quota_file()
295 static int ocfs2_add_recovery_chunk(struct super_block *sb, in ocfs2_add_recovery_chunk() argument
306 rc->rc_bitmap = kmalloc(sb->s_blocksize, GFP_NOFS); in ocfs2_add_recovery_chunk()
312 (ol_chunk_entries(sb) + 7) >> 3); in ocfs2_add_recovery_chunk()
344 struct super_block *sb = lqinode->i_sb; in ocfs2_recovery_load_quota() local
353 ol_quota_chunk_block(sb, i), in ocfs2_recovery_load_quota()
360 if (le32_to_cpu(dchunk->dqc_free) < ol_chunk_entries(sb)) in ocfs2_recovery_load_quota()
361 status = ocfs2_add_recovery_chunk(sb, dchunk, i, head); in ocfs2_recovery_load_quota()
394 struct super_block *sb = osb->sb; in ocfs2_begin_quota_recovery() local
411 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type])) in ocfs2_begin_quota_recovery()
463 struct super_block *sb = lqinode->i_sb; in ocfs2_recover_local_quota_file() local
464 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; in ocfs2_recover_local_quota_file()
481 ol_quota_chunk_block(sb, chunk), in ocfs2_recover_local_quota_file()
488 for_each_set_bit(bit, rchunk->rc_bitmap, ol_chunk_entries(sb)) { in ocfs2_recover_local_quota_file()
491 ol_dqblk_block(sb, chunk, bit), in ocfs2_recover_local_quota_file()
498 ol_dqblk_block_off(sb, chunk, bit)); in ocfs2_recover_local_quota_file()
499 dquot = dqget(sb, in ocfs2_recover_local_quota_file()
517 handle = ocfs2_start_trans(OCFS2_SB(sb), in ocfs2_recover_local_quota_file()
524 mutex_lock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_recover_local_quota_file()
557 mutex_unlock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_recover_local_quota_file()
558 ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_recover_local_quota_file()
589 struct super_block *sb = osb->sb; in ocfs2_finish_quota_recovery() local
601 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); in ocfs2_finish_quota_recovery()
678 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); in ocfs2_finish_quota_recovery()
684 static int ocfs2_local_read_info(struct super_block *sb, int type) in ocfs2_local_read_info() argument
687 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_local_read_info()
689 struct inode *lqinode = sb_dqopt(sb)->files[type]; in ocfs2_local_read_info()
697 mutex_unlock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_local_read_info()
713 status = ocfs2_global_read_info(sb, type); in ocfs2_local_read_info()
741 rec = OCFS2_SB(sb)->quota_rec; in ocfs2_local_read_info()
749 OCFS2_SB(sb)->quota_rec = rec; in ocfs2_local_read_info()
776 mutex_lock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_local_read_info()
781 ocfs2_simple_drop_lockres(OCFS2_SB(sb), &oinfo->dqi_gqlock); in ocfs2_local_read_info()
790 mutex_lock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_local_read_info()
795 static int ocfs2_local_write_info(struct super_block *sb, int type) in ocfs2_local_write_info() argument
797 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_local_write_info()
802 status = ocfs2_modify_bh(sb_dqopt(sb)->files[type], bh, olq_update_info, in ocfs2_local_write_info()
813 static int ocfs2_local_free_info(struct super_block *sb, int type) in ocfs2_local_free_info() argument
815 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_local_free_info()
823 ocfs2_simple_drop_lockres(OCFS2_SB(sb), &oinfo->dqi_gqlock); in ocfs2_local_free_info()
829 len = ol_chunk_entries(sb); in ocfs2_local_free_info()
832 ol_quota_chunk_block(sb, chunk->qc_num) - 1) in ocfs2_local_free_info()
833 * ol_quota_entries_per_block(sb); in ocfs2_local_free_info()
855 status = ocfs2_modify_bh(sb_dqopt(sb)->files[type], in ocfs2_local_free_info()
865 ocfs2_inode_unlock(sb_dqopt(sb)->files[type], 1); in ocfs2_local_free_info()
876 struct super_block *sb = od->dq_dquot.dq_sb; in olq_set_dquot() local
879 + ol_dqblk_block_offset(sb, od->dq_local_off)); in olq_set_dquot()
898 struct super_block *sb = dquot->dq_sb; in ocfs2_local_write_dquot() local
901 struct inode *lqinode = sb_dqopt(sb)->files[dquot->dq_id.type]; in ocfs2_local_write_dquot()
921 static struct ocfs2_quota_chunk *ocfs2_find_free_entry(struct super_block *sb, in ocfs2_find_free_entry() argument
925 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_find_free_entry()
943 len = ol_chunk_entries(sb); in ocfs2_find_free_entry()
946 ol_quota_chunk_block(sb, chunk->qc_num) - 1) in ocfs2_find_free_entry()
947 * ol_quota_entries_per_block(sb); in ocfs2_find_free_entry()
964 struct super_block *sb, in ocfs2_local_quota_add_chunk() argument
968 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_local_quota_add_chunk()
970 struct inode *lqinode = sb_dqopt(sb)->files[type]; in ocfs2_local_quota_add_chunk()
980 i_size_read(lqinode) + 2 * sb->s_blocksize, in ocfs2_local_quota_add_chunk()
987 i_size_read(lqinode) + 2 * sb->s_blocksize); in ocfs2_local_quota_add_chunk()
1000 handle = ocfs2_start_trans(OCFS2_SB(sb), in ocfs2_local_quota_add_chunk()
1016 bh = sb_getblk(sb, p_blkno); in ocfs2_local_quota_add_chunk()
1031 dchunk->dqc_free = cpu_to_le32(ol_quota_entries_per_block(sb)); in ocfs2_local_quota_add_chunk()
1033 sb->s_blocksize - sizeof(struct ocfs2_local_disk_chunk) - in ocfs2_local_quota_add_chunk()
1045 dbh = sb_getblk(sb, p_blkno); in ocfs2_local_quota_add_chunk()
1059 memset(dbh->b_data, 0, sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE); in ocfs2_local_quota_add_chunk()
1066 status = ocfs2_local_write_info(sb, type); in ocfs2_local_quota_add_chunk()
1071 status = ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_local_quota_add_chunk()
1085 ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_local_quota_add_chunk()
1095 struct super_block *sb, in ocfs2_extend_local_quota_file() argument
1099 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_extend_local_quota_file()
1102 struct inode *lqinode = sb_dqopt(sb)->files[type]; in ocfs2_extend_local_quota_file()
1104 int epb = ol_quota_entries_per_block(sb); in ocfs2_extend_local_quota_file()
1112 return ocfs2_local_quota_add_chunk(sb, type, offset); in ocfs2_extend_local_quota_file()
1117 ol_quota_chunk_block(sb, chunk->qc_num) - 1; in ocfs2_extend_local_quota_file()
1118 if (ol_chunk_blocks(sb) == chunk_blocks) in ocfs2_extend_local_quota_file()
1119 return ocfs2_local_quota_add_chunk(sb, type, offset); in ocfs2_extend_local_quota_file()
1123 i_size_read(lqinode) + sb->s_blocksize, in ocfs2_extend_local_quota_file()
1130 i_size_read(lqinode) + sb->s_blocksize); in ocfs2_extend_local_quota_file()
1143 bh = sb_getblk(sb, p_blkno); in ocfs2_extend_local_quota_file()
1152 handle = ocfs2_start_trans(OCFS2_SB(sb), in ocfs2_extend_local_quota_file()
1168 memset(bh->b_data, 0, sb->s_blocksize); in ocfs2_extend_local_quota_file()
1183 le32_add_cpu(&dchunk->dqc_free, ol_quota_entries_per_block(sb)); in ocfs2_extend_local_quota_file()
1189 status = ocfs2_local_write_info(sb, type); in ocfs2_extend_local_quota_file()
1195 status = ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_extend_local_quota_file()
1203 ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_extend_local_quota_file()
1221 struct super_block *sb = dquot->dq_sb; in ocfs2_create_local_dquot() local
1223 struct inode *lqinode = sb_dqopt(sb)->files[type]; in ocfs2_create_local_dquot()
1231 chunk = ocfs2_find_free_entry(sb, type, &offset); in ocfs2_create_local_dquot()
1233 chunk = ocfs2_extend_local_quota_file(sb, type, &offset); in ocfs2_create_local_dquot()
1242 od->dq_local_off = ol_dqblk_off(sb, chunk->qc_num, offset); in ocfs2_create_local_dquot()
1245 ol_dqblk_block(sb, chunk->qc_num, offset), in ocfs2_create_local_dquot()
1278 struct super_block *sb = dquot->dq_sb; in ocfs2_local_release_dquot() local
1283 INODE_CACHE(sb_dqopt(sb)->files[type]), in ocfs2_local_release_dquot()
1289 offset = ol_dqblk_chunk_off(sb, od->dq_chunk->qc_num, in ocfs2_local_release_dquot()