Lines Matching full:sb

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