Lines Matching full:sbi

103 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);  in hfsplus_system_write_inode()  local
104 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_system_write_inode()
111 tree = sbi->ext_tree; in hfsplus_system_write_inode()
115 tree = sbi->cat_tree; in hfsplus_system_write_inode()
125 tree = sbi->attr_tree; in hfsplus_system_write_inode()
132 set_bit(HFSPLUS_SB_WRITEBACKUP, &sbi->flags); in hfsplus_system_write_inode()
179 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_sync_fs() local
180 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_sync_fs()
197 error = filemap_write_and_wait(sbi->cat_tree->inode->i_mapping); in hfsplus_sync_fs()
198 error2 = filemap_write_and_wait(sbi->ext_tree->inode->i_mapping); in hfsplus_sync_fs()
201 if (sbi->attr_tree) { in hfsplus_sync_fs()
203 filemap_write_and_wait(sbi->attr_tree->inode->i_mapping); in hfsplus_sync_fs()
207 error2 = filemap_write_and_wait(sbi->alloc_file->i_mapping); in hfsplus_sync_fs()
211 mutex_lock(&sbi->vh_mutex); in hfsplus_sync_fs()
212 mutex_lock(&sbi->alloc_mutex); in hfsplus_sync_fs()
213 vhdr->free_blocks = cpu_to_be32(sbi->free_blocks); in hfsplus_sync_fs()
214 vhdr->next_cnid = cpu_to_be32(sbi->next_cnid); in hfsplus_sync_fs()
215 vhdr->folder_count = cpu_to_be32(sbi->folder_count); in hfsplus_sync_fs()
216 vhdr->file_count = cpu_to_be32(sbi->file_count); in hfsplus_sync_fs()
218 if (test_and_clear_bit(HFSPLUS_SB_WRITEBACKUP, &sbi->flags)) { in hfsplus_sync_fs()
219 memcpy(sbi->s_backup_vhdr, sbi->s_vhdr, sizeof(*sbi->s_vhdr)); in hfsplus_sync_fs()
224 sbi->part_start + HFSPLUS_VOLHEAD_SECTOR, in hfsplus_sync_fs()
225 sbi->s_vhdr_buf, NULL, REQ_OP_WRITE | in hfsplus_sync_fs()
233 sbi->part_start + sbi->sect_count - 2, in hfsplus_sync_fs()
234 sbi->s_backup_vhdr_buf, NULL, REQ_OP_WRITE | in hfsplus_sync_fs()
239 mutex_unlock(&sbi->alloc_mutex); in hfsplus_sync_fs()
240 mutex_unlock(&sbi->vh_mutex); in hfsplus_sync_fs()
242 if (!test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags)) in hfsplus_sync_fs()
251 struct hfsplus_sb_info *sbi; in delayed_sync_fs() local
253 sbi = container_of(work, struct hfsplus_sb_info, sync_work.work); in delayed_sync_fs()
255 spin_lock(&sbi->work_lock); in delayed_sync_fs()
256 sbi->work_queued = 0; in delayed_sync_fs()
257 spin_unlock(&sbi->work_lock); in delayed_sync_fs()
259 err = hfsplus_sync_fs(sbi->alloc_file->i_sb, 1); in delayed_sync_fs()
266 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_mark_mdb_dirty() local
272 spin_lock(&sbi->work_lock); in hfsplus_mark_mdb_dirty()
273 if (!sbi->work_queued) { in hfsplus_mark_mdb_dirty()
275 queue_delayed_work(system_long_wq, &sbi->sync_work, delay); in hfsplus_mark_mdb_dirty()
276 sbi->work_queued = 1; in hfsplus_mark_mdb_dirty()
278 spin_unlock(&sbi->work_lock); in hfsplus_mark_mdb_dirty()
283 struct hfsplus_sb_info *sbi = container_of(p, struct hfsplus_sb_info, rcu); in delayed_free() local
285 unload_nls(sbi->nls); in delayed_free()
286 kfree(sbi); in delayed_free()
291 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_put_super() local
295 cancel_delayed_work_sync(&sbi->sync_work); in hfsplus_put_super()
297 if (!sb_rdonly(sb) && sbi->s_vhdr) { in hfsplus_put_super()
298 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_put_super()
307 iput(sbi->alloc_file); in hfsplus_put_super()
308 iput(sbi->hidden_dir); in hfsplus_put_super()
309 hfs_btree_close(sbi->attr_tree); in hfsplus_put_super()
310 hfs_btree_close(sbi->cat_tree); in hfsplus_put_super()
311 hfs_btree_close(sbi->ext_tree); in hfsplus_put_super()
312 kfree(sbi->s_vhdr_buf); in hfsplus_put_super()
313 kfree(sbi->s_backup_vhdr_buf); in hfsplus_put_super()
314 call_rcu(&sbi->rcu, delayed_free); in hfsplus_put_super()
320 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_statfs() local
325 buf->f_blocks = sbi->total_blocks << sbi->fs_shift; in hfsplus_statfs()
326 buf->f_bfree = sbi->free_blocks << sbi->fs_shift; in hfsplus_statfs()
329 buf->f_ffree = 0xFFFFFFFF - sbi->next_cnid; in hfsplus_statfs()
344 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_reconfigure() local
345 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_reconfigure()
351 } else if (test_bit(HFSPLUS_SB_FORCE, &sbi->flags)) { in hfsplus_reconfigure()
382 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_fill_super() local
392 mutex_init(&sbi->alloc_mutex); in hfsplus_fill_super()
393 mutex_init(&sbi->vh_mutex); in hfsplus_fill_super()
394 spin_lock_init(&sbi->work_lock); in hfsplus_fill_super()
395 INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs); in hfsplus_fill_super()
398 if (!sbi->nls) { in hfsplus_fill_super()
400 sbi->nls = load_nls("utf8"); in hfsplus_fill_super()
401 if (!sbi->nls) in hfsplus_fill_super()
402 sbi->nls = load_nls_default(); in hfsplus_fill_super()
406 nls = sbi->nls; in hfsplus_fill_super()
407 sbi->nls = load_nls("utf8"); in hfsplus_fill_super()
408 if (!sbi->nls) { in hfsplus_fill_super()
419 vhdr = sbi->s_vhdr; in hfsplus_fill_super()
428 sbi->total_blocks = be32_to_cpu(vhdr->total_blocks); in hfsplus_fill_super()
429 sbi->free_blocks = be32_to_cpu(vhdr->free_blocks); in hfsplus_fill_super()
430 sbi->next_cnid = be32_to_cpu(vhdr->next_cnid); in hfsplus_fill_super()
431 sbi->file_count = be32_to_cpu(vhdr->file_count); in hfsplus_fill_super()
432 sbi->folder_count = be32_to_cpu(vhdr->folder_count); in hfsplus_fill_super()
433 sbi->data_clump_blocks = in hfsplus_fill_super()
434 be32_to_cpu(vhdr->data_clump_sz) >> sbi->alloc_blksz_shift; in hfsplus_fill_super()
435 if (!sbi->data_clump_blocks) in hfsplus_fill_super()
436 sbi->data_clump_blocks = 1; in hfsplus_fill_super()
437 sbi->rsrc_clump_blocks = in hfsplus_fill_super()
438 be32_to_cpu(vhdr->rsrc_clump_sz) >> sbi->alloc_blksz_shift; in hfsplus_fill_super()
439 if (!sbi->rsrc_clump_blocks) in hfsplus_fill_super()
440 sbi->rsrc_clump_blocks = 1; in hfsplus_fill_super()
443 last_fs_block = sbi->total_blocks - 1; in hfsplus_fill_super()
444 last_fs_page = (last_fs_block << sbi->alloc_blksz_shift) >> in hfsplus_fill_super()
447 if ((last_fs_block > (sector_t)(~0ULL) >> (sbi->alloc_blksz_shift - 9)) || in hfsplus_fill_super()
460 } else if (test_and_clear_bit(HFSPLUS_SB_FORCE, &sbi->flags)) { in hfsplus_fill_super()
474 sbi->ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID); in hfsplus_fill_super()
475 if (!sbi->ext_tree) { in hfsplus_fill_super()
479 sbi->cat_tree = hfs_btree_open(sb, HFSPLUS_CAT_CNID); in hfsplus_fill_super()
480 if (!sbi->cat_tree) { in hfsplus_fill_super()
484 atomic_set(&sbi->attr_tree_state, HFSPLUS_EMPTY_ATTR_TREE); in hfsplus_fill_super()
486 sbi->attr_tree = hfs_btree_open(sb, HFSPLUS_ATTR_CNID); in hfsplus_fill_super()
487 if (!sbi->attr_tree) { in hfsplus_fill_super()
491 atomic_set(&sbi->attr_tree_state, HFSPLUS_VALID_ATTR_TREE); in hfsplus_fill_super()
501 sbi->alloc_file = inode; in hfsplus_fill_super()
520 err = hfs_find_init(sbi->cat_tree, &fd); in hfsplus_fill_super()
537 sbi->hidden_dir = inode; in hfsplus_fill_super()
553 if (!sbi->hidden_dir) { in hfsplus_fill_super()
554 mutex_lock(&sbi->vh_mutex); in hfsplus_fill_super()
555 sbi->hidden_dir = hfsplus_new_inode(sb, root, S_IFDIR); in hfsplus_fill_super()
556 if (!sbi->hidden_dir) { in hfsplus_fill_super()
557 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
561 err = hfsplus_create_cat(sbi->hidden_dir->i_ino, root, in hfsplus_fill_super()
562 &str, sbi->hidden_dir); in hfsplus_fill_super()
564 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
568 err = hfsplus_init_security(sbi->hidden_dir, in hfsplus_fill_super()
577 hfsplus_delete_cat(sbi->hidden_dir->i_ino, in hfsplus_fill_super()
579 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
583 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
584 hfsplus_mark_inode_dirty(sbi->hidden_dir, in hfsplus_fill_super()
589 unload_nls(sbi->nls); in hfsplus_fill_super()
590 sbi->nls = nls; in hfsplus_fill_super()
594 cancel_delayed_work_sync(&sbi->sync_work); in hfsplus_fill_super()
595 iput(sbi->hidden_dir); in hfsplus_fill_super()
600 iput(sbi->alloc_file); in hfsplus_fill_super()
602 hfs_btree_close(sbi->attr_tree); in hfsplus_fill_super()
604 hfs_btree_close(sbi->cat_tree); in hfsplus_fill_super()
606 hfs_btree_close(sbi->ext_tree); in hfsplus_fill_super()
608 kfree(sbi->s_vhdr_buf); in hfsplus_fill_super()
609 kfree(sbi->s_backup_vhdr_buf); in hfsplus_fill_super()
611 unload_nls(sbi->nls); in hfsplus_fill_super()
613 kfree(sbi); in hfsplus_fill_super()
657 struct hfsplus_sb_info *sbi; in hfsplus_init_fs_context() local
659 sbi = kzalloc(sizeof(struct hfsplus_sb_info), GFP_KERNEL); in hfsplus_init_fs_context()
660 if (!sbi) in hfsplus_init_fs_context()
664 hfsplus_fill_defaults(sbi); in hfsplus_init_fs_context()
666 fc->s_fs_info = sbi; in hfsplus_init_fs_context()