Lines Matching full:sbi

116 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);  in hfsplus_system_write_inode()  local
117 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_system_write_inode()
124 tree = sbi->ext_tree; in hfsplus_system_write_inode()
128 tree = sbi->cat_tree; in hfsplus_system_write_inode()
138 tree = sbi->attr_tree; in hfsplus_system_write_inode()
145 set_bit(HFSPLUS_SB_WRITEBACKUP, &sbi->flags); in hfsplus_system_write_inode()
192 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_sync_fs() local
193 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_sync_fs()
210 error = filemap_write_and_wait(sbi->cat_tree->inode->i_mapping); in hfsplus_sync_fs()
211 error2 = filemap_write_and_wait(sbi->ext_tree->inode->i_mapping); in hfsplus_sync_fs()
214 if (sbi->attr_tree) { in hfsplus_sync_fs()
216 filemap_write_and_wait(sbi->attr_tree->inode->i_mapping); in hfsplus_sync_fs()
220 error2 = filemap_write_and_wait(sbi->alloc_file->i_mapping); in hfsplus_sync_fs()
224 mutex_lock(&sbi->vh_mutex); in hfsplus_sync_fs()
225 mutex_lock(&sbi->alloc_mutex); in hfsplus_sync_fs()
226 vhdr->free_blocks = cpu_to_be32(sbi->free_blocks); in hfsplus_sync_fs()
227 vhdr->next_cnid = cpu_to_be32(sbi->next_cnid); in hfsplus_sync_fs()
228 vhdr->folder_count = cpu_to_be32(sbi->folder_count); in hfsplus_sync_fs()
229 vhdr->file_count = cpu_to_be32(sbi->file_count); in hfsplus_sync_fs()
232 sbi->free_blocks, sbi->next_cnid, in hfsplus_sync_fs()
233 sbi->folder_count, sbi->file_count); in hfsplus_sync_fs()
235 if (test_and_clear_bit(HFSPLUS_SB_WRITEBACKUP, &sbi->flags)) { in hfsplus_sync_fs()
236 memcpy(sbi->s_backup_vhdr, sbi->s_vhdr, sizeof(*sbi->s_vhdr)); in hfsplus_sync_fs()
241 sbi->part_start + HFSPLUS_VOLHEAD_SECTOR, in hfsplus_sync_fs()
242 sbi->s_vhdr_buf, NULL, REQ_OP_WRITE); in hfsplus_sync_fs()
249 sbi->part_start + sbi->sect_count - 2, in hfsplus_sync_fs()
250 sbi->s_backup_vhdr_buf, NULL, REQ_OP_WRITE); in hfsplus_sync_fs()
254 mutex_unlock(&sbi->alloc_mutex); in hfsplus_sync_fs()
255 mutex_unlock(&sbi->vh_mutex); in hfsplus_sync_fs()
257 if (!test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags)) in hfsplus_sync_fs()
268 struct hfsplus_sb_info *sbi; in delayed_sync_fs() local
270 sbi = container_of(work, struct hfsplus_sb_info, sync_work.work); in delayed_sync_fs()
272 spin_lock(&sbi->work_lock); in delayed_sync_fs()
273 sbi->work_queued = 0; in delayed_sync_fs()
274 spin_unlock(&sbi->work_lock); in delayed_sync_fs()
276 err = hfsplus_sync_fs(sbi->alloc_file->i_sb, 1); in delayed_sync_fs()
283 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_mark_mdb_dirty() local
289 spin_lock(&sbi->work_lock); in hfsplus_mark_mdb_dirty()
290 if (!sbi->work_queued) { in hfsplus_mark_mdb_dirty()
292 queue_delayed_work(system_long_wq, &sbi->sync_work, delay); in hfsplus_mark_mdb_dirty()
293 sbi->work_queued = 1; in hfsplus_mark_mdb_dirty()
295 spin_unlock(&sbi->work_lock); in hfsplus_mark_mdb_dirty()
300 struct hfsplus_sb_info *sbi = container_of(p, struct hfsplus_sb_info, rcu); in delayed_free() local
302 unload_nls(sbi->nls); in delayed_free()
303 kfree(sbi); in delayed_free()
308 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_put_super() local
312 cancel_delayed_work_sync(&sbi->sync_work); in hfsplus_put_super()
314 if (!sb_rdonly(sb) && sbi->s_vhdr) { in hfsplus_put_super()
315 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_put_super()
324 iput(sbi->alloc_file); in hfsplus_put_super()
325 iput(sbi->hidden_dir); in hfsplus_put_super()
326 hfs_btree_close(sbi->attr_tree); in hfsplus_put_super()
327 hfs_btree_close(sbi->cat_tree); in hfsplus_put_super()
328 hfs_btree_close(sbi->ext_tree); in hfsplus_put_super()
329 kfree(sbi->s_vhdr_buf); in hfsplus_put_super()
330 kfree(sbi->s_backup_vhdr_buf); in hfsplus_put_super()
331 call_rcu(&sbi->rcu, delayed_free); in hfsplus_put_super()
339 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_statfs() local
344 buf->f_blocks = sbi->total_blocks << sbi->fs_shift; in hfsplus_statfs()
345 buf->f_bfree = sbi->free_blocks << sbi->fs_shift; in hfsplus_statfs()
348 buf->f_ffree = 0xFFFFFFFF - sbi->next_cnid; in hfsplus_statfs()
363 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_reconfigure() local
364 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_reconfigure()
370 } else if (test_bit(HFSPLUS_SB_FORCE, &sbi->flags)) { in hfsplus_reconfigure()
401 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_fill_super() local
411 mutex_init(&sbi->alloc_mutex); in hfsplus_fill_super()
412 mutex_init(&sbi->vh_mutex); in hfsplus_fill_super()
413 spin_lock_init(&sbi->work_lock); in hfsplus_fill_super()
414 INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs); in hfsplus_fill_super()
417 if (!sbi->nls) { in hfsplus_fill_super()
419 sbi->nls = load_nls("utf8"); in hfsplus_fill_super()
420 if (!sbi->nls) in hfsplus_fill_super()
421 sbi->nls = load_nls_default(); in hfsplus_fill_super()
425 nls = sbi->nls; in hfsplus_fill_super()
426 sbi->nls = load_nls("utf8"); in hfsplus_fill_super()
427 if (!sbi->nls) { in hfsplus_fill_super()
438 vhdr = sbi->s_vhdr; in hfsplus_fill_super()
447 sbi->total_blocks = be32_to_cpu(vhdr->total_blocks); in hfsplus_fill_super()
448 sbi->free_blocks = be32_to_cpu(vhdr->free_blocks); in hfsplus_fill_super()
449 sbi->next_cnid = be32_to_cpu(vhdr->next_cnid); in hfsplus_fill_super()
450 sbi->file_count = be32_to_cpu(vhdr->file_count); in hfsplus_fill_super()
451 sbi->folder_count = be32_to_cpu(vhdr->folder_count); in hfsplus_fill_super()
452 sbi->data_clump_blocks = in hfsplus_fill_super()
453 be32_to_cpu(vhdr->data_clump_sz) >> sbi->alloc_blksz_shift; in hfsplus_fill_super()
454 if (!sbi->data_clump_blocks) in hfsplus_fill_super()
455 sbi->data_clump_blocks = 1; in hfsplus_fill_super()
456 sbi->rsrc_clump_blocks = in hfsplus_fill_super()
457 be32_to_cpu(vhdr->rsrc_clump_sz) >> sbi->alloc_blksz_shift; in hfsplus_fill_super()
458 if (!sbi->rsrc_clump_blocks) in hfsplus_fill_super()
459 sbi->rsrc_clump_blocks = 1; in hfsplus_fill_super()
462 last_fs_block = sbi->total_blocks - 1; in hfsplus_fill_super()
463 last_fs_page = (last_fs_block << sbi->alloc_blksz_shift) >> in hfsplus_fill_super()
466 if ((last_fs_block > (sector_t)(~0ULL) >> (sbi->alloc_blksz_shift - 9)) || in hfsplus_fill_super()
479 } else if (test_and_clear_bit(HFSPLUS_SB_FORCE, &sbi->flags)) { in hfsplus_fill_super()
493 sbi->ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID); in hfsplus_fill_super()
494 if (!sbi->ext_tree) { in hfsplus_fill_super()
498 sbi->cat_tree = hfs_btree_open(sb, HFSPLUS_CAT_CNID); in hfsplus_fill_super()
499 if (!sbi->cat_tree) { in hfsplus_fill_super()
503 atomic_set(&sbi->attr_tree_state, HFSPLUS_EMPTY_ATTR_TREE); in hfsplus_fill_super()
505 sbi->attr_tree = hfs_btree_open(sb, HFSPLUS_ATTR_CNID); in hfsplus_fill_super()
506 if (!sbi->attr_tree) { in hfsplus_fill_super()
510 atomic_set(&sbi->attr_tree_state, HFSPLUS_VALID_ATTR_TREE); in hfsplus_fill_super()
520 sbi->alloc_file = inode; in hfsplus_fill_super()
539 err = hfs_find_init(sbi->cat_tree, &fd); in hfsplus_fill_super()
556 sbi->hidden_dir = inode; in hfsplus_fill_super()
572 if (!sbi->hidden_dir) { in hfsplus_fill_super()
573 mutex_lock(&sbi->vh_mutex); in hfsplus_fill_super()
574 sbi->hidden_dir = hfsplus_new_inode(sb, root, S_IFDIR); in hfsplus_fill_super()
575 if (!sbi->hidden_dir) { in hfsplus_fill_super()
576 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
580 err = hfsplus_create_cat(sbi->hidden_dir->i_ino, root, in hfsplus_fill_super()
581 &str, sbi->hidden_dir); in hfsplus_fill_super()
583 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
587 err = hfsplus_init_security(sbi->hidden_dir, in hfsplus_fill_super()
596 hfsplus_delete_cat(sbi->hidden_dir->i_ino, in hfsplus_fill_super()
598 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
602 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
603 hfsplus_mark_inode_dirty(sbi->hidden_dir, in hfsplus_fill_super()
608 unload_nls(sbi->nls); in hfsplus_fill_super()
609 sbi->nls = nls; in hfsplus_fill_super()
613 cancel_delayed_work_sync(&sbi->sync_work); in hfsplus_fill_super()
614 iput(sbi->hidden_dir); in hfsplus_fill_super()
619 iput(sbi->alloc_file); in hfsplus_fill_super()
621 hfs_btree_close(sbi->attr_tree); in hfsplus_fill_super()
623 hfs_btree_close(sbi->cat_tree); in hfsplus_fill_super()
625 hfs_btree_close(sbi->ext_tree); in hfsplus_fill_super()
627 kfree(sbi->s_vhdr_buf); in hfsplus_fill_super()
628 kfree(sbi->s_backup_vhdr_buf); in hfsplus_fill_super()
630 unload_nls(sbi->nls); in hfsplus_fill_super()
632 kfree(sbi); in hfsplus_fill_super()
676 struct hfsplus_sb_info *sbi; in hfsplus_init_fs_context() local
678 sbi = kzalloc(sizeof(struct hfsplus_sb_info), GFP_KERNEL); in hfsplus_init_fs_context()
679 if (!sbi) in hfsplus_init_fs_context()
683 hfsplus_fill_defaults(sbi); in hfsplus_init_fs_context()
685 fc->s_fs_info = sbi; in hfsplus_init_fs_context()