Lines Matching full:sbi
102 struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb); in hfsplus_system_write_inode() local
103 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_system_write_inode()
110 tree = sbi->ext_tree; in hfsplus_system_write_inode()
114 tree = sbi->cat_tree; in hfsplus_system_write_inode()
124 tree = sbi->attr_tree; in hfsplus_system_write_inode()
131 set_bit(HFSPLUS_SB_WRITEBACKUP, &sbi->flags); in hfsplus_system_write_inode()
178 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_sync_fs() local
179 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_sync_fs()
196 error = filemap_write_and_wait(sbi->cat_tree->inode->i_mapping); in hfsplus_sync_fs()
197 error2 = filemap_write_and_wait(sbi->ext_tree->inode->i_mapping); in hfsplus_sync_fs()
200 if (sbi->attr_tree) { in hfsplus_sync_fs()
202 filemap_write_and_wait(sbi->attr_tree->inode->i_mapping); in hfsplus_sync_fs()
206 error2 = filemap_write_and_wait(sbi->alloc_file->i_mapping); in hfsplus_sync_fs()
210 mutex_lock(&sbi->vh_mutex); in hfsplus_sync_fs()
211 mutex_lock(&sbi->alloc_mutex); in hfsplus_sync_fs()
212 vhdr->free_blocks = cpu_to_be32(sbi->free_blocks); in hfsplus_sync_fs()
213 vhdr->next_cnid = cpu_to_be32(sbi->next_cnid); in hfsplus_sync_fs()
214 vhdr->folder_count = cpu_to_be32(sbi->folder_count); in hfsplus_sync_fs()
215 vhdr->file_count = cpu_to_be32(sbi->file_count); in hfsplus_sync_fs()
217 if (test_and_clear_bit(HFSPLUS_SB_WRITEBACKUP, &sbi->flags)) { in hfsplus_sync_fs()
218 memcpy(sbi->s_backup_vhdr, sbi->s_vhdr, sizeof(*sbi->s_vhdr)); in hfsplus_sync_fs()
223 sbi->part_start + HFSPLUS_VOLHEAD_SECTOR, in hfsplus_sync_fs()
224 sbi->s_vhdr_buf, NULL, REQ_OP_WRITE | in hfsplus_sync_fs()
232 sbi->part_start + sbi->sect_count - 2, in hfsplus_sync_fs()
233 sbi->s_backup_vhdr_buf, NULL, REQ_OP_WRITE | in hfsplus_sync_fs()
238 mutex_unlock(&sbi->alloc_mutex); in hfsplus_sync_fs()
239 mutex_unlock(&sbi->vh_mutex); in hfsplus_sync_fs()
241 if (!test_bit(HFSPLUS_SB_NOBARRIER, &sbi->flags)) in hfsplus_sync_fs()
250 struct hfsplus_sb_info *sbi; in delayed_sync_fs() local
252 sbi = container_of(work, struct hfsplus_sb_info, sync_work.work); in delayed_sync_fs()
254 spin_lock(&sbi->work_lock); in delayed_sync_fs()
255 sbi->work_queued = 0; in delayed_sync_fs()
256 spin_unlock(&sbi->work_lock); in delayed_sync_fs()
258 err = hfsplus_sync_fs(sbi->alloc_file->i_sb, 1); in delayed_sync_fs()
265 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_mark_mdb_dirty() local
271 spin_lock(&sbi->work_lock); in hfsplus_mark_mdb_dirty()
272 if (!sbi->work_queued) { in hfsplus_mark_mdb_dirty()
274 queue_delayed_work(system_long_wq, &sbi->sync_work, delay); in hfsplus_mark_mdb_dirty()
275 sbi->work_queued = 1; in hfsplus_mark_mdb_dirty()
277 spin_unlock(&sbi->work_lock); in hfsplus_mark_mdb_dirty()
282 struct hfsplus_sb_info *sbi = container_of(p, struct hfsplus_sb_info, rcu); in delayed_free() local
284 unload_nls(sbi->nls); in delayed_free()
285 kfree(sbi); in delayed_free()
290 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_put_super() local
294 cancel_delayed_work_sync(&sbi->sync_work); in hfsplus_put_super()
296 if (!sb_rdonly(sb) && sbi->s_vhdr) { in hfsplus_put_super()
297 struct hfsplus_vh *vhdr = sbi->s_vhdr; in hfsplus_put_super()
306 iput(sbi->alloc_file); in hfsplus_put_super()
307 iput(sbi->hidden_dir); in hfsplus_put_super()
308 hfs_btree_close(sbi->attr_tree); in hfsplus_put_super()
309 hfs_btree_close(sbi->cat_tree); in hfsplus_put_super()
310 hfs_btree_close(sbi->ext_tree); in hfsplus_put_super()
311 kfree(sbi->s_vhdr_buf); in hfsplus_put_super()
312 kfree(sbi->s_backup_vhdr_buf); in hfsplus_put_super()
313 call_rcu(&sbi->rcu, delayed_free); in hfsplus_put_super()
319 struct hfsplus_sb_info *sbi = HFSPLUS_SB(sb); in hfsplus_statfs() local
324 buf->f_blocks = sbi->total_blocks << sbi->fs_shift; in hfsplus_statfs()
325 buf->f_bfree = sbi->free_blocks << sbi->fs_shift; in hfsplus_statfs()
328 buf->f_ffree = 0xFFFFFFFF - sbi->next_cnid; in hfsplus_statfs()
383 struct hfsplus_sb_info *sbi; in hfsplus_fill_super() local
393 sbi = kzalloc(sizeof(*sbi), GFP_KERNEL); in hfsplus_fill_super()
394 if (!sbi) in hfsplus_fill_super()
397 sb->s_fs_info = sbi; in hfsplus_fill_super()
398 mutex_init(&sbi->alloc_mutex); in hfsplus_fill_super()
399 mutex_init(&sbi->vh_mutex); in hfsplus_fill_super()
400 spin_lock_init(&sbi->work_lock); in hfsplus_fill_super()
401 INIT_DELAYED_WORK(&sbi->sync_work, delayed_sync_fs); in hfsplus_fill_super()
402 hfsplus_fill_defaults(sbi); in hfsplus_fill_super()
405 if (!hfsplus_parse_options(data, sbi)) { in hfsplus_fill_super()
411 nls = sbi->nls; in hfsplus_fill_super()
412 sbi->nls = load_nls("utf8"); in hfsplus_fill_super()
413 if (!sbi->nls) { in hfsplus_fill_super()
424 vhdr = sbi->s_vhdr; in hfsplus_fill_super()
433 sbi->total_blocks = be32_to_cpu(vhdr->total_blocks); in hfsplus_fill_super()
434 sbi->free_blocks = be32_to_cpu(vhdr->free_blocks); in hfsplus_fill_super()
435 sbi->next_cnid = be32_to_cpu(vhdr->next_cnid); in hfsplus_fill_super()
436 sbi->file_count = be32_to_cpu(vhdr->file_count); in hfsplus_fill_super()
437 sbi->folder_count = be32_to_cpu(vhdr->folder_count); in hfsplus_fill_super()
438 sbi->data_clump_blocks = in hfsplus_fill_super()
439 be32_to_cpu(vhdr->data_clump_sz) >> sbi->alloc_blksz_shift; in hfsplus_fill_super()
440 if (!sbi->data_clump_blocks) in hfsplus_fill_super()
441 sbi->data_clump_blocks = 1; in hfsplus_fill_super()
442 sbi->rsrc_clump_blocks = in hfsplus_fill_super()
443 be32_to_cpu(vhdr->rsrc_clump_sz) >> sbi->alloc_blksz_shift; in hfsplus_fill_super()
444 if (!sbi->rsrc_clump_blocks) in hfsplus_fill_super()
445 sbi->rsrc_clump_blocks = 1; in hfsplus_fill_super()
448 last_fs_block = sbi->total_blocks - 1; in hfsplus_fill_super()
449 last_fs_page = (last_fs_block << sbi->alloc_blksz_shift) >> in hfsplus_fill_super()
452 if ((last_fs_block > (sector_t)(~0ULL) >> (sbi->alloc_blksz_shift - 9)) || in hfsplus_fill_super()
465 } else if (test_and_clear_bit(HFSPLUS_SB_FORCE, &sbi->flags)) { in hfsplus_fill_super()
479 sbi->ext_tree = hfs_btree_open(sb, HFSPLUS_EXT_CNID); in hfsplus_fill_super()
480 if (!sbi->ext_tree) { in hfsplus_fill_super()
484 sbi->cat_tree = hfs_btree_open(sb, HFSPLUS_CAT_CNID); in hfsplus_fill_super()
485 if (!sbi->cat_tree) { in hfsplus_fill_super()
489 atomic_set(&sbi->attr_tree_state, HFSPLUS_EMPTY_ATTR_TREE); in hfsplus_fill_super()
491 sbi->attr_tree = hfs_btree_open(sb, HFSPLUS_ATTR_CNID); in hfsplus_fill_super()
492 if (!sbi->attr_tree) { in hfsplus_fill_super()
496 atomic_set(&sbi->attr_tree_state, HFSPLUS_VALID_ATTR_TREE); in hfsplus_fill_super()
506 sbi->alloc_file = inode; in hfsplus_fill_super()
525 err = hfs_find_init(sbi->cat_tree, &fd); in hfsplus_fill_super()
542 sbi->hidden_dir = inode; in hfsplus_fill_super()
558 if (!sbi->hidden_dir) { in hfsplus_fill_super()
559 mutex_lock(&sbi->vh_mutex); in hfsplus_fill_super()
560 sbi->hidden_dir = hfsplus_new_inode(sb, root, S_IFDIR); in hfsplus_fill_super()
561 if (!sbi->hidden_dir) { in hfsplus_fill_super()
562 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
566 err = hfsplus_create_cat(sbi->hidden_dir->i_ino, root, in hfsplus_fill_super()
567 &str, sbi->hidden_dir); in hfsplus_fill_super()
569 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
573 err = hfsplus_init_security(sbi->hidden_dir, in hfsplus_fill_super()
582 hfsplus_delete_cat(sbi->hidden_dir->i_ino, in hfsplus_fill_super()
584 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
588 mutex_unlock(&sbi->vh_mutex); in hfsplus_fill_super()
589 hfsplus_mark_inode_dirty(sbi->hidden_dir, in hfsplus_fill_super()
594 unload_nls(sbi->nls); in hfsplus_fill_super()
595 sbi->nls = nls; in hfsplus_fill_super()
599 cancel_delayed_work_sync(&sbi->sync_work); in hfsplus_fill_super()
600 iput(sbi->hidden_dir); in hfsplus_fill_super()
605 iput(sbi->alloc_file); in hfsplus_fill_super()
607 hfs_btree_close(sbi->attr_tree); in hfsplus_fill_super()
609 hfs_btree_close(sbi->cat_tree); in hfsplus_fill_super()
611 hfs_btree_close(sbi->ext_tree); in hfsplus_fill_super()
613 kfree(sbi->s_vhdr_buf); in hfsplus_fill_super()
614 kfree(sbi->s_backup_vhdr_buf); in hfsplus_fill_super()
616 unload_nls(sbi->nls); in hfsplus_fill_super()
618 kfree(sbi); in hfsplus_fill_super()