Lines Matching refs:inode
26 nilfs_palloc_groups_per_desc_block(const struct inode *inode) in nilfs_palloc_groups_per_desc_block() argument
28 return i_blocksize(inode) / in nilfs_palloc_groups_per_desc_block()
37 nilfs_palloc_groups_count(const struct inode *inode) in nilfs_palloc_groups_count() argument
39 return 1UL << (BITS_PER_LONG - (inode->i_blkbits + 3 /* log2(8) */)); in nilfs_palloc_groups_count()
47 int nilfs_palloc_init_blockgroup(struct inode *inode, unsigned int entry_size) in nilfs_palloc_init_blockgroup() argument
49 struct nilfs_mdt_info *mi = NILFS_MDT(inode); in nilfs_palloc_init_blockgroup()
57 nilfs_mdt_set_entry_size(inode, entry_size, 0); in nilfs_palloc_init_blockgroup()
60 DIV_ROUND_UP(nilfs_palloc_entries_per_group(inode), in nilfs_palloc_init_blockgroup()
67 nilfs_palloc_groups_per_desc_block(inode) * in nilfs_palloc_init_blockgroup()
82 static unsigned long nilfs_palloc_group(const struct inode *inode, __u64 nr, in nilfs_palloc_group() argument
87 *offset = do_div(group, nilfs_palloc_entries_per_group(inode)); in nilfs_palloc_group()
100 nilfs_palloc_desc_blkoff(const struct inode *inode, unsigned long group) in nilfs_palloc_desc_blkoff() argument
103 group / nilfs_palloc_groups_per_desc_block(inode); in nilfs_palloc_desc_blkoff()
104 return desc_block * NILFS_MDT(inode)->mi_blocks_per_desc_block; in nilfs_palloc_desc_blkoff()
116 nilfs_palloc_bitmap_blkoff(const struct inode *inode, unsigned long group) in nilfs_palloc_bitmap_blkoff() argument
119 group % nilfs_palloc_groups_per_desc_block(inode); in nilfs_palloc_bitmap_blkoff()
120 return nilfs_palloc_desc_blkoff(inode, group) + 1 + in nilfs_palloc_bitmap_blkoff()
121 desc_offset * NILFS_MDT(inode)->mi_blocks_per_group; in nilfs_palloc_bitmap_blkoff()
166 nilfs_palloc_entry_blkoff(const struct inode *inode, __u64 nr) in nilfs_palloc_entry_blkoff() argument
170 group = nilfs_palloc_group(inode, nr, &group_offset); in nilfs_palloc_entry_blkoff()
172 return nilfs_palloc_bitmap_blkoff(inode, group) + 1 + in nilfs_palloc_entry_blkoff()
173 group_offset / NILFS_MDT(inode)->mi_entries_per_block; in nilfs_palloc_entry_blkoff()
182 static void nilfs_palloc_desc_block_init(struct inode *inode, in nilfs_palloc_desc_block_init() argument
186 unsigned long n = nilfs_palloc_groups_per_desc_block(inode); in nilfs_palloc_desc_block_init()
189 nfrees = cpu_to_le32(nilfs_palloc_entries_per_group(inode)); in nilfs_palloc_desc_block_init()
196 static int nilfs_palloc_get_block(struct inode *inode, unsigned long blkoff, in nilfs_palloc_get_block() argument
198 void (*init_block)(struct inode *, in nilfs_palloc_get_block() argument
217 ret = nilfs_mdt_get_block(inode, blkoff, create, init_block, bhp); in nilfs_palloc_get_block()
240 static int nilfs_palloc_delete_block(struct inode *inode, unsigned long blkoff, in nilfs_palloc_delete_block() argument
250 return nilfs_mdt_delete_block(inode, blkoff); in nilfs_palloc_delete_block()
260 static int nilfs_palloc_get_desc_block(struct inode *inode, in nilfs_palloc_get_desc_block() argument
264 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_get_desc_block()
266 return nilfs_palloc_get_block(inode, in nilfs_palloc_get_desc_block()
267 nilfs_palloc_desc_blkoff(inode, group), in nilfs_palloc_get_desc_block()
279 static int nilfs_palloc_get_bitmap_block(struct inode *inode, in nilfs_palloc_get_bitmap_block() argument
283 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_get_bitmap_block()
285 return nilfs_palloc_get_block(inode, in nilfs_palloc_get_bitmap_block()
286 nilfs_palloc_bitmap_blkoff(inode, group), in nilfs_palloc_get_bitmap_block()
296 static int nilfs_palloc_delete_bitmap_block(struct inode *inode, in nilfs_palloc_delete_bitmap_block() argument
299 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_delete_bitmap_block()
301 return nilfs_palloc_delete_block(inode, in nilfs_palloc_delete_bitmap_block()
302 nilfs_palloc_bitmap_blkoff(inode, in nilfs_palloc_delete_bitmap_block()
314 int nilfs_palloc_get_entry_block(struct inode *inode, __u64 nr, in nilfs_palloc_get_entry_block() argument
317 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_get_entry_block()
319 return nilfs_palloc_get_block(inode, in nilfs_palloc_get_entry_block()
320 nilfs_palloc_entry_blkoff(inode, nr), in nilfs_palloc_get_entry_block()
330 static int nilfs_palloc_delete_entry_block(struct inode *inode, __u64 nr) in nilfs_palloc_delete_entry_block() argument
332 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_delete_entry_block()
334 return nilfs_palloc_delete_block(inode, in nilfs_palloc_delete_entry_block()
335 nilfs_palloc_entry_blkoff(inode, nr), in nilfs_palloc_delete_entry_block()
347 nilfs_palloc_block_get_group_desc(const struct inode *inode, in nilfs_palloc_block_get_group_desc() argument
352 group % nilfs_palloc_groups_per_desc_block(inode); in nilfs_palloc_block_get_group_desc()
362 void *nilfs_palloc_block_get_entry(const struct inode *inode, __u64 nr, in nilfs_palloc_block_get_entry() argument
367 nilfs_palloc_group(inode, nr, &group_offset); in nilfs_palloc_block_get_entry()
368 entry_offset = group_offset % NILFS_MDT(inode)->mi_entries_per_block; in nilfs_palloc_block_get_entry()
371 entry_offset * NILFS_MDT(inode)->mi_entry_size; in nilfs_palloc_block_get_entry()
421 nilfs_palloc_rest_groups_in_desc_block(const struct inode *inode, in nilfs_palloc_rest_groups_in_desc_block() argument
425 nilfs_palloc_groups_per_desc_block(inode) - in nilfs_palloc_rest_groups_in_desc_block()
426 curr % nilfs_palloc_groups_per_desc_block(inode), in nilfs_palloc_rest_groups_in_desc_block()
435 static int nilfs_palloc_count_desc_blocks(struct inode *inode, in nilfs_palloc_count_desc_blocks() argument
441 ret = nilfs_bmap_last_key(NILFS_I(inode)->i_bmap, &blknum); in nilfs_palloc_count_desc_blocks()
445 NILFS_MDT(inode)->mi_blocks_per_desc_block); in nilfs_palloc_count_desc_blocks()
455 static inline bool nilfs_palloc_mdt_file_can_grow(struct inode *inode, in nilfs_palloc_mdt_file_can_grow() argument
458 return (nilfs_palloc_groups_per_desc_block(inode) * desc_blocks) < in nilfs_palloc_mdt_file_can_grow()
459 nilfs_palloc_groups_count(inode); in nilfs_palloc_mdt_file_can_grow()
469 int nilfs_palloc_count_max_entries(struct inode *inode, u64 nused, u64 *nmaxp) in nilfs_palloc_count_max_entries() argument
475 err = nilfs_palloc_count_desc_blocks(inode, &desc_blocks); in nilfs_palloc_count_max_entries()
479 entries_per_desc_block = (u64)nilfs_palloc_entries_per_group(inode) * in nilfs_palloc_count_max_entries()
480 nilfs_palloc_groups_per_desc_block(inode); in nilfs_palloc_count_max_entries()
484 nilfs_palloc_mdt_file_can_grow(inode, desc_blocks)) in nilfs_palloc_count_max_entries()
499 int nilfs_palloc_prepare_alloc_entry(struct inode *inode, in nilfs_palloc_prepare_alloc_entry() argument
513 ngroups = nilfs_palloc_groups_count(inode); in nilfs_palloc_prepare_alloc_entry()
515 group = nilfs_palloc_group(inode, req->pr_entry_nr, &group_offset); in nilfs_palloc_prepare_alloc_entry()
516 entries_per_group = nilfs_palloc_entries_per_group(inode); in nilfs_palloc_prepare_alloc_entry()
522 maxgroup = nilfs_palloc_group(inode, req->pr_entry_nr, in nilfs_palloc_prepare_alloc_entry()
525 ret = nilfs_palloc_get_desc_block(inode, group, 1, &desc_bh); in nilfs_palloc_prepare_alloc_entry()
530 inode, group, desc_bh, desc_kaddr); in nilfs_palloc_prepare_alloc_entry()
531 n = nilfs_palloc_rest_groups_in_desc_block(inode, group, in nilfs_palloc_prepare_alloc_entry()
534 lock = nilfs_mdt_bgl_lock(inode, group); in nilfs_palloc_prepare_alloc_entry()
537 inode, group, 1, &bitmap_bh); in nilfs_palloc_prepare_alloc_entry()
583 void nilfs_palloc_commit_alloc_entry(struct inode *inode, in nilfs_palloc_commit_alloc_entry() argument
588 nilfs_mdt_mark_dirty(inode); in nilfs_palloc_commit_alloc_entry()
599 void nilfs_palloc_commit_free_entry(struct inode *inode, in nilfs_palloc_commit_free_entry() argument
608 group = nilfs_palloc_group(inode, req->pr_entry_nr, &group_offset); in nilfs_palloc_commit_free_entry()
610 desc = nilfs_palloc_block_get_group_desc(inode, group, in nilfs_palloc_commit_free_entry()
614 lock = nilfs_mdt_bgl_lock(inode, group); in nilfs_palloc_commit_free_entry()
617 nilfs_warn(inode->i_sb, in nilfs_palloc_commit_free_entry()
619 __func__, inode->i_ino, in nilfs_palloc_commit_free_entry()
629 nilfs_mdt_mark_dirty(inode); in nilfs_palloc_commit_free_entry()
640 void nilfs_palloc_abort_alloc_entry(struct inode *inode, in nilfs_palloc_abort_alloc_entry() argument
649 group = nilfs_palloc_group(inode, req->pr_entry_nr, &group_offset); in nilfs_palloc_abort_alloc_entry()
651 desc = nilfs_palloc_block_get_group_desc(inode, group, in nilfs_palloc_abort_alloc_entry()
655 lock = nilfs_mdt_bgl_lock(inode, group); in nilfs_palloc_abort_alloc_entry()
658 nilfs_warn(inode->i_sb, in nilfs_palloc_abort_alloc_entry()
660 __func__, inode->i_ino, in nilfs_palloc_abort_alloc_entry()
681 int nilfs_palloc_prepare_free_entry(struct inode *inode, in nilfs_palloc_prepare_free_entry() argument
688 group = nilfs_palloc_group(inode, req->pr_entry_nr, &group_offset); in nilfs_palloc_prepare_free_entry()
689 ret = nilfs_palloc_get_desc_block(inode, group, 1, &desc_bh); in nilfs_palloc_prepare_free_entry()
692 ret = nilfs_palloc_get_bitmap_block(inode, group, 1, &bitmap_bh); in nilfs_palloc_prepare_free_entry()
708 void nilfs_palloc_abort_free_entry(struct inode *inode, in nilfs_palloc_abort_free_entry() argument
725 int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems) in nilfs_palloc_freev() argument
733 const unsigned long epg = nilfs_palloc_entries_per_group(inode); in nilfs_palloc_freev()
734 const unsigned int epb = NILFS_MDT(inode)->mi_entries_per_block; in nilfs_palloc_freev()
744 group = nilfs_palloc_group(inode, entry_nrs[i], &group_offset); in nilfs_palloc_freev()
745 ret = nilfs_palloc_get_desc_block(inode, group, 0, &desc_bh); in nilfs_palloc_freev()
748 ret = nilfs_palloc_get_bitmap_block(inode, group, 0, in nilfs_palloc_freev()
760 lock = nilfs_mdt_bgl_lock(inode, group); in nilfs_palloc_freev()
767 nilfs_warn(inode->i_sb, in nilfs_palloc_freev()
769 __func__, inode->i_ino, in nilfs_palloc_freev()
809 ret = nilfs_palloc_delete_entry_block(inode, in nilfs_palloc_freev()
812 nilfs_warn(inode->i_sb, in nilfs_palloc_freev()
815 inode->i_ino); in nilfs_palloc_freev()
820 inode, group, desc_bh, desc_kaddr); in nilfs_palloc_freev()
824 nilfs_mdt_mark_dirty(inode); in nilfs_palloc_freev()
827 if (nfree == nilfs_palloc_entries_per_group(inode)) { in nilfs_palloc_freev()
828 ret = nilfs_palloc_delete_bitmap_block(inode, group); in nilfs_palloc_freev()
830 nilfs_warn(inode->i_sb, in nilfs_palloc_freev()
832 ret, group, inode->i_ino); in nilfs_palloc_freev()
838 void nilfs_palloc_setup_cache(struct inode *inode, in nilfs_palloc_setup_cache() argument
841 NILFS_MDT(inode)->mi_palloc_cache = cache; in nilfs_palloc_setup_cache()
845 void nilfs_palloc_clear_cache(struct inode *inode) in nilfs_palloc_clear_cache() argument
847 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_clear_cache()
859 void nilfs_palloc_destroy_cache(struct inode *inode) in nilfs_palloc_destroy_cache() argument
861 nilfs_palloc_clear_cache(inode); in nilfs_palloc_destroy_cache()
862 NILFS_MDT(inode)->mi_palloc_cache = NULL; in nilfs_palloc_destroy_cache()