Lines Matching refs:sb
132 int ocfs2_validate_quota_block(struct super_block *sb, struct buffer_head *bh) in ocfs2_validate_quota_block() argument
135 ocfs2_block_dqtrailer(sb->s_blocksize, bh->b_data); in ocfs2_validate_quota_block()
146 return ocfs2_validate_meta_ecc(sb, bh->b_data, &dqt->dq_check); in ocfs2_validate_quota_block()
165 ssize_t ocfs2_quota_read(struct super_block *sb, int type, char *data, in ocfs2_quota_read() argument
168 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; in ocfs2_quota_read()
171 int offset = off & (sb->s_blocksize - 1); in ocfs2_quota_read()
172 sector_t blk = off >> sb->s_blocksize_bits; in ocfs2_quota_read()
184 tocopy = min_t(size_t, (sb->s_blocksize - offset), toread); in ocfs2_quota_read()
214 ssize_t ocfs2_quota_write(struct super_block *sb, int type, in ocfs2_quota_write() argument
217 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_quota_write()
220 int offset = off & (sb->s_blocksize - 1); in ocfs2_quota_write()
221 sector_t blk = off >> sb->s_blocksize_bits; in ocfs2_quota_write()
233 if (len > sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE - offset) { in ocfs2_quota_write()
235 len = sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE - offset; in ocfs2_quota_write()
240 ocfs2_align_bytes_to_blocks(sb, off + len); in ocfs2_quota_write()
256 if ((offset || len < sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE) && in ocfs2_quota_write()
261 bh = sb_getblk(sb, pblock); in ocfs2_quota_write()
272 memset(bh->b_data, 0, sb->s_blocksize); in ocfs2_quota_write()
336 int ocfs2_global_read_info(struct super_block *sb, int type) in ocfs2_global_read_info() argument
342 struct mem_dqinfo *info = sb_dqinfo(sb, type); in ocfs2_global_read_info()
348 gqinode = ocfs2_get_system_file_inode(OCFS2_SB(sb), ino[type], in ocfs2_global_read_info()
356 oinfo->dqi_gi.dqi_sb = sb; in ocfs2_global_read_info()
378 status = sb->s_op->quota_read(sb, type, (char *)&dinfo, in ocfs2_global_read_info()
397 oinfo->dqi_gi.dqi_blocksize_bits = sb->s_blocksize_bits; in ocfs2_global_read_info()
398 oinfo->dqi_gi.dqi_usable_bs = sb->s_blocksize - in ocfs2_global_read_info()
415 static int __ocfs2_global_write_info(struct super_block *sb, int type) in __ocfs2_global_write_info() argument
417 struct mem_dqinfo *info = sb_dqinfo(sb, type); in __ocfs2_global_write_info()
431 size = sb->s_op->quota_write(sb, type, (char *)&dinfo, in __ocfs2_global_write_info()
443 int ocfs2_global_write_info(struct super_block *sb, int type) in ocfs2_global_write_info() argument
446 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv; in ocfs2_global_write_info()
451 err = __ocfs2_global_write_info(sb, type); in ocfs2_global_write_info()
456 static int ocfs2_global_qinit_alloc(struct super_block *sb, int type) in ocfs2_global_qinit_alloc() argument
458 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; in ocfs2_global_qinit_alloc()
467 static int ocfs2_calc_global_qinit_credits(struct super_block *sb, int type) in ocfs2_calc_global_qinit_credits() argument
471 return (ocfs2_global_qinit_alloc(sb, type) + 2) * in ocfs2_calc_global_qinit_credits()
481 struct super_block *sb = dquot->dq_sb; in __ocfs2_sync_dquot() local
483 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv; in __ocfs2_sync_dquot()
488 err = sb->s_op->quota_read(sb, type, (char *)&dqblk, in __ocfs2_sync_dquot()
574 if (info_dirty(sb_dqinfo(sb, type))) { in __ocfs2_sync_dquot()
575 err2 = __ocfs2_global_write_info(sb, type); in __ocfs2_sync_dquot()
594 struct super_block *sb = dquot->dq_sb; in ocfs2_sync_dquot_helper() local
595 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; in ocfs2_sync_dquot_helper()
596 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_sync_dquot_helper()
601 type, sb->s_id); in ocfs2_sync_dquot_helper()
614 mutex_lock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_sync_dquot_helper()
622 mutex_unlock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_sync_dquot_helper()
635 struct super_block *sb = oinfo->dqi_gqinode->i_sb; in qsync_work_fn() local
637 dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type); in qsync_work_fn()
669 static int ocfs2_calc_qdel_credits(struct super_block *sb, int type) in ocfs2_calc_qdel_credits() argument
671 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; in ocfs2_calc_qdel_credits()
782 struct super_block *sb = dquot->dq_sb; in ocfs2_acquire_dquot() local
783 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_acquire_dquot()
785 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv; in ocfs2_acquire_dquot()
787 int need_alloc = ocfs2_global_qinit_alloc(sb, type); in ocfs2_acquire_dquot()
823 i_size_read(gqinode) + (need_alloc << sb->s_blocksize_bits), in ocfs2_acquire_dquot()
830 ocfs2_calc_global_qinit_credits(sb, type)); in ocfs2_acquire_dquot()
839 if (ex && info_dirty(sb_dqinfo(sb, type))) { in ocfs2_acquire_dquot()
840 err = __ocfs2_global_write_info(sb, type); in ocfs2_acquire_dquot()
873 struct super_block *sb = dquot->dq_sb; in ocfs2_mark_dquot_dirty() local
875 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; in ocfs2_mark_dquot_dirty()
877 struct ocfs2_super *osb = OCFS2_SB(sb); in ocfs2_mark_dquot_dirty()
903 mutex_lock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_mark_dquot_dirty()
912 mutex_unlock(&sb_dqopt(sb)->dqio_mutex); in ocfs2_mark_dquot_dirty()
923 static int ocfs2_write_info(struct super_block *sb, int type) in ocfs2_write_info() argument
927 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; in ocfs2_write_info()
932 handle = ocfs2_start_trans(OCFS2_SB(sb), OCFS2_QINFO_WRITE_CREDITS); in ocfs2_write_info()
938 status = dquot_commit_info(sb, type); in ocfs2_write_info()
939 ocfs2_commit_trans(OCFS2_SB(sb), handle); in ocfs2_write_info()
948 static struct dquot *ocfs2_alloc_dquot(struct super_block *sb, int type) in ocfs2_alloc_dquot() argument