Lines Matching refs:sbi

101 	struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb);  in hfsplus_system_write_inode()  local
102 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_system_write_inode()
109 tree = sbi->ext_tree; in hfsplus_system_write_inode()
113 tree = sbi->cat_tree; in hfsplus_system_write_inode()
123 tree = sbi->attr_tree; in hfsplus_system_write_inode()
130 set_bit(HFSPLUS_SB_WRITEBACKUP, &sbi->flags); in hfsplus_system_write_inode()
177 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_sync_fs() local
178 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_sync_fs()
195 error = filemap_write_and_wait(sbi->cat_tree->inode->i_mapping); in hfsplus_sync_fs()
196 error2 = filemap_write_and_wait(sbi->ext_tree->inode->i_mapping); in hfsplus_sync_fs()
199 if (sbi->attr_tree) { in hfsplus_sync_fs()
201 filemap_write_and_wait(sbi->attr_tree->inode->i_mapping); in hfsplus_sync_fs()
205 error2 = filemap_write_and_wait(sbi->alloc_file->i_mapping); in hfsplus_sync_fs()
209 mutex_lock(&sbi->vh_mutex); in hfsplus_sync_fs()
210 mutex_lock(&sbi->alloc_mutex); in hfsplus_sync_fs()
211 vhdr->free_blocks = cpu_to_be32(sbi->free_blocks); in hfsplus_sync_fs()
212 vhdr->next_cnid = cpu_to_be32(sbi->next_cnid); in hfsplus_sync_fs()
213 vhdr->folder_count = cpu_to_be32(sbi->folder_count); in hfsplus_sync_fs()
214 vhdr->file_count = cpu_to_be32(sbi->file_count); in hfsplus_sync_fs()
216 if (test_and_clear_bit(HFSPLUS_SB_WRITEBACKUP, &sbi->flags)) { in hfsplus_sync_fs()
217 memcpy(sbi->s_backup_vhdr, sbi->s_vhdr, sizeof(*sbi->s_vhdr)); in hfsplus_sync_fs()
222 sbi->part_start + HFSPLUS_VOLHEAD_SECTOR, in hfsplus_sync_fs()
223 sbi->s_vhdr_buf, NULL, REQ_OP_WRITE, in hfsplus_sync_fs()
231 sbi->part_start + sbi->sect_count - 2, in hfsplus_sync_fs()
232 sbi->s_backup_vhdr_buf, NULL, REQ_OP_WRITE, in hfsplus_sync_fs()
237 mutex_unlock(&sbi->alloc_mutex); in hfsplus_sync_fs()
238 mutex_unlock(&sbi->vh_mutex); in hfsplus_sync_fs()
240 if (!test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags)) in hfsplus_sync_fs()
249 struct hfsplus_sb_info *sbi; in delayed_sync_fs() local
251 sbi = container_of(work, struct hfsplus_sb_info, sync_work.work); in delayed_sync_fs()
253 spin_lock(&sbi->work_lock); in delayed_sync_fs()
254 sbi->work_queued = 0; in delayed_sync_fs()
255 spin_unlock(&sbi->work_lock); in delayed_sync_fs()
257 err = hfsplus_sync_fs(sbi->alloc_file->i_sb, 1); in delayed_sync_fs()
264 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_mark_mdb_dirty() local
270 spin_lock(&sbi->work_lock); in hfsplus_mark_mdb_dirty()
271 if (!sbi->work_queued) { in hfsplus_mark_mdb_dirty()
273 queue_delayed_work(system_long_wq, &sbi->sync_work, delay); in hfsplus_mark_mdb_dirty()
274 sbi->work_queued = 1; in hfsplus_mark_mdb_dirty()
276 spin_unlock(&sbi->work_lock); in hfsplus_mark_mdb_dirty()
281 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_put_super() local
285 cancel_delayed_work_sync(&sbi->sync_work); in hfsplus_put_super()
287 if (!sb_rdonly(sb) && sbi->s_vhdr) { in hfsplus_put_super()
288 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_put_super()
297 iput(sbi->alloc_file); in hfsplus_put_super()
298 iput(sbi->hidden_dir); in hfsplus_put_super()
299 hfs_btree_close(sbi->attr_tree); in hfsplus_put_super()
300 hfs_btree_close(sbi->cat_tree); in hfsplus_put_super()
301 hfs_btree_close(sbi->ext_tree); in hfsplus_put_super()
302 kfree(sbi->s_vhdr_buf); in hfsplus_put_super()
303 kfree(sbi->s_backup_vhdr_buf); in hfsplus_put_super()
304 unload_nls(sbi->nls); in hfsplus_put_super()
312 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_statfs() local
317 buf->f_blocks = sbi->total_blocks << sbi->fs_shift; in hfsplus_statfs()
318 buf->f_bfree = sbi->free_blocks << sbi->fs_shift; in hfsplus_statfs()
321 buf->f_ffree = 0xFFFFFFFF - sbi->next_cnid; in hfsplus_statfs()
377 struct hfsplus_sb_info *sbi; in hfsplus_fill_super() local
387 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in hfsplus_fill_super()
388 if (!sbi) in hfsplus_fill_super()
391 sb->s_fs_info = sbi; in hfsplus_fill_super()
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()
396 hfsplus_fill_defaults(sbi); in hfsplus_fill_super()
399 if (!hfsplus_parse_options(data, sbi)) { in hfsplus_fill_super()
405 nls = sbi->nls; in hfsplus_fill_super()
406 sbi->nls = load_nls("utf8"); in hfsplus_fill_super()
407 if (!sbi->nls) { in hfsplus_fill_super()
418 vhdr = sbi->s_vhdr; in hfsplus_fill_super()
427 sbi->total_blocks = be32_to_cpu(vhdr->total_blocks); in hfsplus_fill_super()
428 sbi->free_blocks = be32_to_cpu(vhdr->free_blocks); in hfsplus_fill_super()
429 sbi->next_cnid = be32_to_cpu(vhdr->next_cnid); in hfsplus_fill_super()
430 sbi->file_count = be32_to_cpu(vhdr->file_count); in hfsplus_fill_super()
431 sbi->folder_count = be32_to_cpu(vhdr->folder_count); in hfsplus_fill_super()
432 sbi->data_clump_blocks = in hfsplus_fill_super()
433 be32_to_cpu(vhdr->data_clump_sz) >> sbi->alloc_blksz_shift; in hfsplus_fill_super()
434 if (!sbi->data_clump_blocks) in hfsplus_fill_super()
435 sbi->data_clump_blocks = 1; in hfsplus_fill_super()
436 sbi->rsrc_clump_blocks = in hfsplus_fill_super()
437 be32_to_cpu(vhdr->rsrc_clump_sz) >> sbi->alloc_blksz_shift; in hfsplus_fill_super()
438 if (!sbi->rsrc_clump_blocks) in hfsplus_fill_super()
439 sbi->rsrc_clump_blocks = 1; in hfsplus_fill_super()
442 last_fs_block = sbi->total_blocks - 1; in hfsplus_fill_super()
443 last_fs_page = (last_fs_block << sbi->alloc_blksz_shift) >> in hfsplus_fill_super()
446 if ((last_fs_block > (sector_t)(~0ULL) >> (sbi->alloc_blksz_shift - 9)) || in hfsplus_fill_super()
459 } else if (test_and_clear_bit(HFSPLUS_SB_FORCE, &sbi->flags)) { in hfsplus_fill_super()
473 sbi->ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID); in hfsplus_fill_super()
474 if (!sbi->ext_tree) { in hfsplus_fill_super()
478 sbi->cat_tree = hfs_btree_open(sb, HFSPLUS_CAT_CNID); in hfsplus_fill_super()
479 if (!sbi->cat_tree) { in hfsplus_fill_super()
483 atomic_set(&sbi->attr_tree_state, HFSPLUS_EMPTY_ATTR_TREE); in hfsplus_fill_super()
485 sbi->attr_tree = hfs_btree_open(sb, HFSPLUS_ATTR_CNID); in hfsplus_fill_super()
486 if (!sbi->attr_tree) { in hfsplus_fill_super()
490 atomic_set(&sbi->attr_tree_state, HFSPLUS_VALID_ATTR_TREE); in hfsplus_fill_super()
500 sbi->alloc_file = inode; in hfsplus_fill_super()
519 err = hfs_find_init(sbi->cat_tree, &fd); in hfsplus_fill_super()
536 sbi->hidden_dir = inode; in hfsplus_fill_super()
552 if (!sbi->hidden_dir) { in hfsplus_fill_super()
553 mutex_lock(&sbi->vh_mutex); in hfsplus_fill_super()
554 sbi->hidden_dir = hfsplus_new_inode(sb, root, S_IFDIR); in hfsplus_fill_super()
555 if (!sbi->hidden_dir) { in hfsplus_fill_super()
556 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
560 err = hfsplus_create_cat(sbi->hidden_dir->i_ino, root, in hfsplus_fill_super()
561 &str, sbi->hidden_dir); in hfsplus_fill_super()
563 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
567 err = hfsplus_init_security(sbi->hidden_dir, in hfsplus_fill_super()
576 hfsplus_delete_cat(sbi->hidden_dir->i_ino, in hfsplus_fill_super()
578 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
582 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
583 hfsplus_mark_inode_dirty(sbi->hidden_dir, in hfsplus_fill_super()
588 unload_nls(sbi->nls); in hfsplus_fill_super()
589 sbi->nls = nls; in hfsplus_fill_super()
593 cancel_delayed_work_sync(&sbi->sync_work); in hfsplus_fill_super()
594 iput(sbi->hidden_dir); in hfsplus_fill_super()
599 iput(sbi->alloc_file); in hfsplus_fill_super()
601 hfs_btree_close(sbi->attr_tree); in hfsplus_fill_super()
603 hfs_btree_close(sbi->cat_tree); in hfsplus_fill_super()
605 hfs_btree_close(sbi->ext_tree); in hfsplus_fill_super()
607 kfree(sbi->s_vhdr_buf); in hfsplus_fill_super()
608 kfree(sbi->s_backup_vhdr_buf); in hfsplus_fill_super()
610 unload_nls(sbi->nls); in hfsplus_fill_super()
612 kfree(sbi); in hfsplus_fill_super()