Lines Matching refs:sb

14 static int exfat_mirror_bh(struct super_block *sb, sector_t sec,
18 struct exfat_sb_info *sbi = EXFAT_SB(sb);
24 c_bh = sb_getblk(sb, sec2);
27 memcpy(c_bh->b_data, bh->b_data, sb->s_blocksize);
30 if (sb->s_flags & SB_SYNCHRONOUS)
38 static int __exfat_ent_get(struct super_block *sb, unsigned int loc,
45 sec = FAT_ENT_OFFSET_SECTOR(sb, loc);
46 off = FAT_ENT_OFFSET_BYTE_IN_SECTOR(sb, loc);
48 bh = sb_bread(sb, sec);
62 int exfat_ent_set(struct super_block *sb, unsigned int loc,
70 sec = FAT_ENT_OFFSET_SECTOR(sb, loc);
71 off = FAT_ENT_OFFSET_BYTE_IN_SECTOR(sb, loc);
73 bh = sb_bread(sb, sec);
79 exfat_update_bh(bh, sb->s_flags & SB_SYNCHRONOUS);
80 exfat_mirror_bh(sb, sec, bh);
85 int exfat_ent_get(struct super_block *sb, unsigned int loc,
88 struct exfat_sb_info *sbi = EXFAT_SB(sb);
92 exfat_fs_error(sb, "invalid access to FAT (entry 0x%08x)",
97 err = __exfat_ent_get(sb, loc, content);
99 exfat_fs_error(sb,
106 exfat_fs_error(sb,
113 exfat_fs_error(sb,
120 exfat_fs_error(sb,
129 int exfat_chain_cont_cluster(struct super_block *sb, unsigned int chain,
136 if (exfat_ent_set(sb, chain, chain + 1))
142 if (exfat_ent_set(sb, chain, EXFAT_EOF_CLUSTER))
150 struct super_block *sb = inode->i_sb;
151 struct exfat_sb_info *sbi = EXFAT_SB(sb);
168 exfat_err(sb, "invalid start cluster (%u)", p_chain->dir);
175 BITMAP_OFFSET_SECTOR_INDEX(sb, CLUSTER_TO_BITMAP_ENT(clu));
184 BITMAP_OFFSET_SECTOR_INDEX(sb, CLUSTER_TO_BITMAP_ENT(clu+1));
200 int err = exfat_get_next_cluster(sb, &n_clu);
206 BITMAP_OFFSET_SECTOR_INDEX(sb, CLUSTER_TO_BITMAP_ENT(n_clu));
238 int exfat_find_last_cluster(struct super_block *sb, struct exfat_chain *p_chain,
253 if (exfat_ent_get(sb, clu, &next))
258 exfat_fs_error(sb,
270 struct super_block *sb = dir->i_sb;
271 struct exfat_sb_info *sbi = EXFAT_SB(sb);
279 exfat_fs_error_ratelimit(sb,
288 bh = sb_getblk(sb, i);
292 memset(bh->b_data, 0, sb->s_blocksize);
299 return sync_blockdev_range(sb->s_bdev,
300 EXFAT_BLK_TO_B(blknr, sb),
301 EXFAT_BLK_TO_B(last_blknr, sb) - 1);
312 struct super_block *sb = inode->i_sb;
313 struct exfat_sb_info *sbi = EXFAT_SB(sb);
318 exfat_fs_error_ratelimit(sb,
333 exfat_err(sb, "sbi->clu_srch_ptr is invalid (%u)",
338 hint_clu = exfat_find_free_bitmap(sb, sbi->clu_srch_ptr);
348 exfat_err(sb, "hint_cluster is invalid (%u), rewind to the first cluster",
356 while ((new_clu = exfat_find_free_bitmap(sb, hint_clu)) !=
360 if (exfat_chain_cont_cluster(sb, p_chain->dir,
376 if (exfat_ent_set(sb, new_clu, EXFAT_EOF_CLUSTER)) {
385 if (exfat_ent_set(sb, last_clu, new_clu)) {
407 if (exfat_chain_cont_cluster(sb, p_chain->dir,
423 int exfat_count_num_clusters(struct super_block *sb,
428 struct exfat_sb_info *sbi = EXFAT_SB(sb);
444 if (exfat_ent_get(sb, clu, &clu))