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
216 ret = nilfs_mdt_get_block(inode, blkoff, create, init_block, bhp); in nilfs_palloc_get_block()
239 static int nilfs_palloc_delete_block(struct inode *inode, unsigned long blkoff, in nilfs_palloc_delete_block() argument
249 return nilfs_mdt_delete_block(inode, blkoff); in nilfs_palloc_delete_block()
259 static int nilfs_palloc_get_desc_block(struct inode *inode, in nilfs_palloc_get_desc_block() argument
263 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_get_desc_block()
265 return nilfs_palloc_get_block(inode, in nilfs_palloc_get_desc_block()
266 nilfs_palloc_desc_blkoff(inode, group), in nilfs_palloc_get_desc_block()
278 static int nilfs_palloc_get_bitmap_block(struct inode *inode, in nilfs_palloc_get_bitmap_block() argument
282 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_get_bitmap_block()
284 return nilfs_palloc_get_block(inode, in nilfs_palloc_get_bitmap_block()
285 nilfs_palloc_bitmap_blkoff(inode, group), in nilfs_palloc_get_bitmap_block()
295 static int nilfs_palloc_delete_bitmap_block(struct inode *inode, in nilfs_palloc_delete_bitmap_block() argument
298 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_delete_bitmap_block()
300 return nilfs_palloc_delete_block(inode, in nilfs_palloc_delete_bitmap_block()
301 nilfs_palloc_bitmap_blkoff(inode, in nilfs_palloc_delete_bitmap_block()
313 int nilfs_palloc_get_entry_block(struct inode *inode, __u64 nr, in nilfs_palloc_get_entry_block() argument
316 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_get_entry_block()
318 return nilfs_palloc_get_block(inode, in nilfs_palloc_get_entry_block()
319 nilfs_palloc_entry_blkoff(inode, nr), in nilfs_palloc_get_entry_block()
329 static int nilfs_palloc_delete_entry_block(struct inode *inode, __u64 nr) in nilfs_palloc_delete_entry_block() argument
331 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_delete_entry_block()
333 return nilfs_palloc_delete_block(inode, in nilfs_palloc_delete_entry_block()
334 nilfs_palloc_entry_blkoff(inode, nr), in nilfs_palloc_delete_entry_block()
346 nilfs_palloc_block_get_group_desc(const struct inode *inode, in nilfs_palloc_block_get_group_desc() argument
351 group % nilfs_palloc_groups_per_desc_block(inode); in nilfs_palloc_block_get_group_desc()
361 void *nilfs_palloc_block_get_entry(const struct inode *inode, __u64 nr, in nilfs_palloc_block_get_entry() argument
366 nilfs_palloc_group(inode, nr, &group_offset); in nilfs_palloc_block_get_entry()
367 entry_offset = group_offset % NILFS_MDT(inode)->mi_entries_per_block; in nilfs_palloc_block_get_entry()
370 entry_offset * NILFS_MDT(inode)->mi_entry_size; in nilfs_palloc_block_get_entry()
420 nilfs_palloc_rest_groups_in_desc_block(const struct inode *inode, in nilfs_palloc_rest_groups_in_desc_block() argument
424 nilfs_palloc_groups_per_desc_block(inode) - in nilfs_palloc_rest_groups_in_desc_block()
425 curr % nilfs_palloc_groups_per_desc_block(inode), in nilfs_palloc_rest_groups_in_desc_block()
434 static int nilfs_palloc_count_desc_blocks(struct inode *inode, in nilfs_palloc_count_desc_blocks() argument
440 ret = nilfs_bmap_last_key(NILFS_I(inode)->i_bmap, &blknum); in nilfs_palloc_count_desc_blocks()
444 NILFS_MDT(inode)->mi_blocks_per_desc_block); in nilfs_palloc_count_desc_blocks()
454 static inline bool nilfs_palloc_mdt_file_can_grow(struct inode *inode, in nilfs_palloc_mdt_file_can_grow() argument
457 return (nilfs_palloc_groups_per_desc_block(inode) * desc_blocks) < in nilfs_palloc_mdt_file_can_grow()
458 nilfs_palloc_groups_count(inode); in nilfs_palloc_mdt_file_can_grow()
468 int nilfs_palloc_count_max_entries(struct inode *inode, u64 nused, u64 *nmaxp) in nilfs_palloc_count_max_entries() argument
474 err = nilfs_palloc_count_desc_blocks(inode, &desc_blocks); in nilfs_palloc_count_max_entries()
478 entries_per_desc_block = (u64)nilfs_palloc_entries_per_group(inode) * in nilfs_palloc_count_max_entries()
479 nilfs_palloc_groups_per_desc_block(inode); in nilfs_palloc_count_max_entries()
483 nilfs_palloc_mdt_file_can_grow(inode, desc_blocks)) in nilfs_palloc_count_max_entries()
498 int nilfs_palloc_prepare_alloc_entry(struct inode *inode, in nilfs_palloc_prepare_alloc_entry() argument
512 ngroups = nilfs_palloc_groups_count(inode); in nilfs_palloc_prepare_alloc_entry()
514 group = nilfs_palloc_group(inode, req->pr_entry_nr, &group_offset); in nilfs_palloc_prepare_alloc_entry()
515 entries_per_group = nilfs_palloc_entries_per_group(inode); in nilfs_palloc_prepare_alloc_entry()
521 maxgroup = nilfs_palloc_group(inode, req->pr_entry_nr, in nilfs_palloc_prepare_alloc_entry()
524 ret = nilfs_palloc_get_desc_block(inode, group, 1, &desc_bh); in nilfs_palloc_prepare_alloc_entry()
529 inode, group, desc_bh, desc_kaddr); in nilfs_palloc_prepare_alloc_entry()
530 n = nilfs_palloc_rest_groups_in_desc_block(inode, group, in nilfs_palloc_prepare_alloc_entry()
533 lock = nilfs_mdt_bgl_lock(inode, group); in nilfs_palloc_prepare_alloc_entry()
536 inode, group, 1, &bitmap_bh); in nilfs_palloc_prepare_alloc_entry()
582 void nilfs_palloc_commit_alloc_entry(struct inode *inode, in nilfs_palloc_commit_alloc_entry() argument
587 nilfs_mdt_mark_dirty(inode); in nilfs_palloc_commit_alloc_entry()
598 void nilfs_palloc_commit_free_entry(struct inode *inode, in nilfs_palloc_commit_free_entry() argument
607 group = nilfs_palloc_group(inode, req->pr_entry_nr, &group_offset); in nilfs_palloc_commit_free_entry()
609 desc = nilfs_palloc_block_get_group_desc(inode, group, in nilfs_palloc_commit_free_entry()
613 lock = nilfs_mdt_bgl_lock(inode, group); in nilfs_palloc_commit_free_entry()
616 nilfs_warn(inode->i_sb, in nilfs_palloc_commit_free_entry()
618 __func__, inode->i_ino, in nilfs_palloc_commit_free_entry()
628 nilfs_mdt_mark_dirty(inode); in nilfs_palloc_commit_free_entry()
639 void nilfs_palloc_abort_alloc_entry(struct inode *inode, in nilfs_palloc_abort_alloc_entry() argument
648 group = nilfs_palloc_group(inode, req->pr_entry_nr, &group_offset); in nilfs_palloc_abort_alloc_entry()
650 desc = nilfs_palloc_block_get_group_desc(inode, group, in nilfs_palloc_abort_alloc_entry()
654 lock = nilfs_mdt_bgl_lock(inode, group); in nilfs_palloc_abort_alloc_entry()
657 nilfs_warn(inode->i_sb, in nilfs_palloc_abort_alloc_entry()
659 __func__, inode->i_ino, in nilfs_palloc_abort_alloc_entry()
680 int nilfs_palloc_prepare_free_entry(struct inode *inode, in nilfs_palloc_prepare_free_entry() argument
687 group = nilfs_palloc_group(inode, req->pr_entry_nr, &group_offset); in nilfs_palloc_prepare_free_entry()
688 ret = nilfs_palloc_get_desc_block(inode, group, 1, &desc_bh); in nilfs_palloc_prepare_free_entry()
691 ret = nilfs_palloc_get_bitmap_block(inode, group, 1, &bitmap_bh); in nilfs_palloc_prepare_free_entry()
707 void nilfs_palloc_abort_free_entry(struct inode *inode, in nilfs_palloc_abort_free_entry() argument
724 int nilfs_palloc_freev(struct inode *inode, __u64 *entry_nrs, size_t nitems) in nilfs_palloc_freev() argument
732 const unsigned long epg = nilfs_palloc_entries_per_group(inode); in nilfs_palloc_freev()
733 const unsigned int epb = NILFS_MDT(inode)->mi_entries_per_block; in nilfs_palloc_freev()
743 group = nilfs_palloc_group(inode, entry_nrs[i], &group_offset); in nilfs_palloc_freev()
744 ret = nilfs_palloc_get_desc_block(inode, group, 0, &desc_bh); in nilfs_palloc_freev()
747 ret = nilfs_palloc_get_bitmap_block(inode, group, 0, in nilfs_palloc_freev()
759 lock = nilfs_mdt_bgl_lock(inode, group); in nilfs_palloc_freev()
766 nilfs_warn(inode->i_sb, in nilfs_palloc_freev()
768 __func__, inode->i_ino, in nilfs_palloc_freev()
808 ret = nilfs_palloc_delete_entry_block(inode, in nilfs_palloc_freev()
811 nilfs_warn(inode->i_sb, in nilfs_palloc_freev()
814 inode->i_ino); in nilfs_palloc_freev()
819 inode, group, desc_bh, desc_kaddr); in nilfs_palloc_freev()
823 nilfs_mdt_mark_dirty(inode); in nilfs_palloc_freev()
826 if (nfree == nilfs_palloc_entries_per_group(inode)) { in nilfs_palloc_freev()
827 ret = nilfs_palloc_delete_bitmap_block(inode, group); in nilfs_palloc_freev()
829 nilfs_warn(inode->i_sb, in nilfs_palloc_freev()
831 ret, group, inode->i_ino); in nilfs_palloc_freev()
837 void nilfs_palloc_setup_cache(struct inode *inode, in nilfs_palloc_setup_cache() argument
840 NILFS_MDT(inode)->mi_palloc_cache = cache; in nilfs_palloc_setup_cache()
844 void nilfs_palloc_clear_cache(struct inode *inode) in nilfs_palloc_clear_cache() argument
846 struct nilfs_palloc_cache *cache = NILFS_MDT(inode)->mi_palloc_cache; in nilfs_palloc_clear_cache()
858 void nilfs_palloc_destroy_cache(struct inode *inode) in nilfs_palloc_destroy_cache() argument
860 nilfs_palloc_clear_cache(inode); in nilfs_palloc_destroy_cache()
861 NILFS_MDT(inode)->mi_palloc_cache = NULL; in nilfs_palloc_destroy_cache()