Searched refs:bix (Results 1 - 8 of 8) sorted by relevance

/linux-4.1.27/fs/logfs/
H A Dreadwrite.c23 static u64 adjust_bix(u64 bix, level_t level) adjust_bix() argument
27 return bix; adjust_bix()
29 return max_t(u64, bix, I0_BLOCKS); adjust_bix()
31 return max_t(u64, bix, I1_BLOCKS); adjust_bix()
33 return max_t(u64, bix, I2_BLOCKS); adjust_bix()
35 return max_t(u64, bix, I3_BLOCKS); adjust_bix()
37 return max_t(u64, bix, I4_BLOCKS); adjust_bix()
40 return bix; adjust_bix()
52 * set, the actual block index (bix) and level can be derived from the page
67 pgoff_t logfs_pack_index(u64 bix, level_t level) logfs_pack_index() argument
71 BUG_ON(bix >= INDIRECT_BIT); logfs_pack_index()
73 return bix; logfs_pack_index()
77 index |= bix >> ((__force u8)level * LOGFS_BLOCK_BITS); logfs_pack_index()
81 void logfs_unpack_index(pgoff_t index, u64 *bix, level_t *level) logfs_unpack_index() argument
86 *bix = index; logfs_unpack_index()
93 *bix = (index << (__level * LOGFS_BLOCK_BITS)) & ~INDIRECT_BIT; logfs_unpack_index()
94 *bix = adjust_bix(*bix, *level); logfs_unpack_index()
274 static struct page *logfs_get_read_page(struct inode *inode, u64 bix, logfs_get_read_page() argument
278 logfs_pack_index(bix, level), GFP_NOFS); logfs_get_read_page()
310 static struct page *logfs_get_write_page(struct inode *inode, u64 bix, logfs_get_write_page() argument
314 pgoff_t index = logfs_pack_index(bix, level); logfs_get_write_page()
348 static struct page *logfs_get_page(struct inode *inode, u64 bix, level_t level, logfs_get_page() argument
352 return logfs_get_read_page(inode, bix, level); logfs_get_page()
354 return logfs_get_write_page(inode, bix, level); logfs_get_page()
467 u64 ino , bix; inode_write_alias() local
495 bix = inode->i_ino; inode_write_alias()
497 err = write_one_alias(sb, ino, bix, level, pos, val); inode_write_alias()
508 u64 ino , bix; indirect_write_alias() local
519 logfs_unpack_index(page->index, &bix, &level); indirect_write_alias()
523 err = write_one_alias(sb, ino, bix, level, pos, val); indirect_write_alias()
585 u64 ino, u64 bix, level_t level) __alloc_block()
596 block->bix = bix; __alloc_block()
647 u64 bix; alloc_data_block() local
653 logfs_unpack_index(page->index, &bix, &level); alloc_data_block()
654 block = __alloc_block(inode->i_sb, inode->i_ino, bix, level); alloc_data_block()
733 u64 bix, bofs = li->li_data[INDIRECT_INDEX]; logfs_read_loop() local
738 logfs_unpack_index(page->index, &bix, &target_level); logfs_read_loop()
742 if (bix >= maxbix(li->li_height)) logfs_read_loop()
748 ipage = logfs_get_page(inode, bix, level, rw_context); logfs_read_loop()
752 ret = logfs_segment_read(inode, ipage, bofs, bix, level); logfs_read_loop()
758 bofs = block_get_pointer(ipage, get_bits(bix, SUBLEVEL(level))); logfs_read_loop()
764 return logfs_segment_read(inode, page, bofs, bix, 0); logfs_read_loop()
777 static int logfs_exist_loop(struct inode *inode, u64 bix) logfs_exist_loop() argument
787 if (bix >= maxbix(li->li_height)) logfs_exist_loop()
791 ipage = logfs_get_read_page(inode, bix, level); logfs_exist_loop()
795 ret = logfs_segment_read(inode, ipage, bofs, bix, level); logfs_exist_loop()
801 bofs = block_get_pointer(ipage, get_bits(bix, SUBLEVEL(level))); logfs_exist_loop()
810 int logfs_exist_block(struct inode *inode, u64 bix) logfs_exist_block() argument
814 if (bix < I0_BLOCKS) logfs_exist_block()
815 return !!li->li_data[bix]; logfs_exist_block()
816 return logfs_exist_loop(inode, bix); logfs_exist_block()
819 static u64 seek_holedata_direct(struct inode *inode, u64 bix, int data) seek_holedata_direct() argument
823 for (; bix < I0_BLOCKS; bix++) seek_holedata_direct()
824 if (data ^ (li->li_data[bix] == 0)) seek_holedata_direct()
825 return bix; seek_holedata_direct()
829 static u64 seek_holedata_loop(struct inode *inode, u64 bix, int data) seek_holedata_loop() argument
842 page = logfs_get_read_page(inode, bix, level); seek_holedata_loop()
844 return bix; seek_holedata_loop()
846 ret = logfs_segment_read(inode, page, bofs, bix, level); seek_holedata_loop()
849 return bix; seek_holedata_loop()
852 slot = get_bits(bix, SUBLEVEL(level)); seek_holedata_loop()
860 bix += increment; seek_holedata_loop()
861 bix &= ~(increment - 1); seek_holedata_loop()
866 return bix; seek_holedata_loop()
873 return bix; seek_holedata_loop()
876 return bix; seek_holedata_loop()
882 * @bix: block index to start searching
887 u64 logfs_seek_hole(struct inode *inode, u64 bix) logfs_seek_hole() argument
891 if (bix < I0_BLOCKS) { logfs_seek_hole()
892 bix = seek_holedata_direct(inode, bix, 0); logfs_seek_hole()
893 if (bix < I0_BLOCKS) logfs_seek_hole()
894 return bix; logfs_seek_hole()
898 return bix; logfs_seek_hole()
900 bix = maxbix(li->li_height); logfs_seek_hole()
901 else if (bix >= maxbix(li->li_height)) logfs_seek_hole()
902 return bix; logfs_seek_hole()
904 bix = seek_holedata_loop(inode, bix, 0); logfs_seek_hole()
905 if (bix < maxbix(li->li_height)) logfs_seek_hole()
906 return bix; logfs_seek_hole()
910 WARN_ON_ONCE(bix == maxbix(li->li_height)); logfs_seek_hole()
913 return bix; logfs_seek_hole()
916 static u64 __logfs_seek_data(struct inode *inode, u64 bix) __logfs_seek_data() argument
920 if (bix < I0_BLOCKS) { __logfs_seek_data()
921 bix = seek_holedata_direct(inode, bix, 1); __logfs_seek_data()
922 if (bix < I0_BLOCKS) __logfs_seek_data()
923 return bix; __logfs_seek_data()
926 if (bix < maxbix(li->li_height)) { __logfs_seek_data()
928 bix = maxbix(li->li_height); __logfs_seek_data()
930 return seek_holedata_loop(inode, bix, 1); __logfs_seek_data()
933 return bix; __logfs_seek_data()
939 * @bix: block index to start searching
944 u64 logfs_seek_data(struct inode *inode, u64 bix) logfs_seek_data() argument
949 ret = __logfs_seek_data(inode, bix); logfs_seek_data()
952 ret = max(bix, end); logfs_seek_data()
956 static int logfs_is_valid_direct(struct logfs_inode *li, u64 bix, u64 ofs) logfs_is_valid_direct() argument
958 return pure_ofs(li->li_data[bix]) == ofs; logfs_is_valid_direct()
961 static int __logfs_is_valid_loop(struct inode *inode, u64 bix, __logfs_is_valid_loop() argument
970 page = logfs_get_write_page(inode, bix, level); __logfs_is_valid_loop()
973 ret = logfs_segment_read(inode, page, bofs, bix, level); __logfs_is_valid_loop()
979 bofs = block_get_pointer(page, get_bits(bix, SUBLEVEL(level))); __logfs_is_valid_loop()
990 static int logfs_is_valid_loop(struct inode *inode, u64 bix, u64 ofs) logfs_is_valid_loop() argument
998 if (bix >= maxbix(li->li_height)) logfs_is_valid_loop()
1004 return __logfs_is_valid_loop(inode, bix, ofs, bofs); logfs_is_valid_loop()
1007 static int __logfs_is_valid_block(struct inode *inode, u64 bix, u64 ofs) __logfs_is_valid_block() argument
1014 if (bix < I0_BLOCKS) __logfs_is_valid_block()
1015 return logfs_is_valid_direct(li, bix, ofs); __logfs_is_valid_block()
1016 return logfs_is_valid_loop(inode, bix, ofs); __logfs_is_valid_block()
1025 * @bix: block index
1031 int logfs_is_valid_block(struct super_block *sb, u64 ofs, u64 ino, u64 bix, logfs_is_valid_block() argument
1049 ret = __logfs_is_valid_block(inode, bix, ofs); logfs_is_valid_block()
1217 static struct logfs_shadow *alloc_shadow(struct inode *inode, u64 bix, alloc_shadow() argument
1226 shadow->bix = bix; alloc_shadow()
1344 u64 bix; logfs_write_i0() local
1348 logfs_unpack_index(page->index, &bix, &level); logfs_write_i0()
1353 shadow = alloc_shadow(inode, bix, level, wc->ofs); logfs_write_i0()
1418 pgoff_t bix, level_t target_level, level_t level) __logfs_write_rec()
1421 int child_no = get_bits(bix, SUBLEVEL(level)); __logfs_write_rec()
1427 ipage = logfs_get_write_page(inode, bix, level); __logfs_write_rec()
1432 ret = logfs_segment_read(inode, ipage, this_wc->ofs, bix, level); __logfs_write_rec()
1443 ret = __logfs_write_rec(inode, page, &child_wc, bix, __logfs_write_rec()
1468 pgoff_t bix, level_t target_level, long flags) logfs_write_rec()
1480 ret = __logfs_write_rec(inode, page, &wc, bix, target_level, logfs_write_rec()
1509 static int grow_inode(struct inode *inode, u64 bix, level_t level) grow_inode() argument
1520 while (height > li->li_height || bix >= maxbix(li->li_height)) { grow_inode()
1544 u64 bix; __logfs_write_buf() local
1551 logfs_unpack_index(index, &bix, &level); __logfs_write_buf()
1558 bix = adjust_bix(bix, level); __logfs_write_buf()
1559 err = grow_inode(inode, bix, level); __logfs_write_buf()
1562 return logfs_write_rec(inode, page, bix, level, flags); __logfs_write_buf()
1611 int logfs_rewrite_block(struct inode *inode, u64 bix, u64 ofs, logfs_rewrite_block() argument
1618 page = logfs_get_write_page(inode, bix, level); logfs_rewrite_block()
1622 err = logfs_segment_read(inode, page, ofs, bix, level); logfs_rewrite_block()
1648 u64 bix; truncate_data_block() local
1656 logfs_unpack_index(page->index, &bix, &level); truncate_data_block()
1659 err = logfs_segment_read(inode, page, ofs, bix, level); truncate_data_block()
1671 u64 bix; logfs_truncate_i0() local
1675 logfs_unpack_index(page->index, &bix, &level); logfs_truncate_i0()
1677 shadow = alloc_shadow(inode, bix, level, wc->ofs); logfs_truncate_i0()
1758 static void logfs_unpack_raw_index(pgoff_t index, u64 *bix, level_t *level) logfs_unpack_raw_index() argument
1760 logfs_unpack_index(index, bix, level); logfs_unpack_raw_index()
1761 if (*bix <= logfs_start_index(SUBLEVEL(*level))) logfs_unpack_raw_index()
1762 *bix = 0; logfs_unpack_raw_index()
1770 u64 bix, child_bix, next_bix; __logfs_truncate_rec() local
1775 logfs_unpack_raw_index(ipage->index, &bix, &level); __logfs_truncate_rec()
1776 err = logfs_segment_read(inode, ipage, this_wc->ofs, bix, level); __logfs_truncate_rec()
1781 child_bix = bix + e * logfs_step(SUBLEVEL(level)); __logfs_truncate_rec()
1913 block->ino, block->bix, block->level); move_page_to_inode()
1936 block->ino, block->bix, block->level); move_inode_to_page()
2210 page = logfs_get_write_page(inode, block->bix, block->level); btree_write_block()
2230 * @bix: block index
2239 loff_t bix, long flags, struct shadow_tree *shadow_tree) logfs_inode_write()
2241 loff_t pos = bix << inode->i_sb->s_blocksize_bits; logfs_inode_write()
2248 page = logfs_get_write_page(inode, bix, 0); logfs_inode_write()
584 __alloc_block(struct super_block *sb, u64 ino, u64 bix, level_t level) __alloc_block() argument
1416 __logfs_write_rec(struct inode *inode, struct page *page, struct write_control *this_wc, pgoff_t bix, level_t target_level, level_t level) __logfs_write_rec() argument
1467 logfs_write_rec(struct inode *inode, struct page *page, pgoff_t bix, level_t target_level, long flags) logfs_write_rec() argument
2238 logfs_inode_write(struct inode *inode, const void *buf, size_t count, loff_t bix, long flags, struct shadow_tree *shadow_tree) logfs_inode_write() argument
H A Dsegment.c163 * We have to be careful with the alias tree. Since lookup is done by bix,
167 static void *alias_tree_lookup(struct super_block *sb, u64 ino, u64 bix, alias_tree_lookup() argument
171 pgoff_t index = logfs_pack_index(bix, level); alias_tree_lookup()
176 static int alias_tree_insert(struct super_block *sb, u64 ino, u64 bix, alias_tree_insert() argument
180 pgoff_t index = logfs_pack_index(bix, level); alias_tree_insert()
192 err = write_alias_journal(sb, block->ino, block->bix, btree_write_alias()
212 u64 ino, bix; logfs_load_object_aliases() local
229 bix = be64_to_cpu(oa[i].bix); logfs_load_object_aliases()
233 ino, bix, level, item->child_no, logfs_load_object_aliases()
235 block = alias_tree_lookup(sb, ino, bix, level); logfs_load_object_aliases()
237 block = __alloc_block(sb, ino, bix, level); logfs_load_object_aliases()
239 err = alias_tree_insert(sb, ino, bix, level, block); logfs_load_object_aliases()
322 h.bix = cpu_to_be64(shadow->bix); __logfs_segment_write()
392 shadow->ino, shadow->bix, shadow->gc_level, logfs_segment_write()
492 block->ino, block->bix, block->level); move_btree_to_page()
535 block->ino, block->bix, block->level); move_page_to_btree()
561 err = alias_tree_insert(block->sb, block->ino, block->bix, block->level, move_page_to_btree()
568 u64 ofs, u64 bix, level_t level) __logfs_segment_read()
584 || check_pos(sb, be64_to_cpu(oh.bix), bix, level)) { __logfs_segment_read()
585 printk(KERN_ERR"LOGFS: (ino, bix) don't match at %llx: " __logfs_segment_read()
587 ofs, inode->i_ino, bix, __logfs_segment_read()
588 be64_to_cpu(oh.ino), be64_to_cpu(oh.bix)); __logfs_segment_read()
651 * @bix: block index
657 u64 ofs, u64 bix, level_t level) logfs_segment_read()
668 err = __logfs_segment_read(inode, buf, ofs, bix, level); logfs_segment_read()
675 inode->i_ino, bix, level, ofs, err); logfs_segment_read()
694 shadow->ino, shadow->bix, shadow->gc_level, logfs_segment_delete()
700 LOGFS_BUG_ON(check_pos(sb, shadow->bix, be64_to_cpu(h.bix), logfs_segment_delete()
567 __logfs_segment_read(struct inode *inode, void *buf, u64 ofs, u64 bix, level_t level) __logfs_segment_read() argument
656 logfs_segment_read(struct inode *inode, struct page *page, u64 ofs, u64 bix, level_t level) logfs_segment_read() argument
H A Dfile.c123 u64 bix; logfs_writepage() local
129 logfs_unpack_index(page->index, &bix, &level); logfs_writepage()
141 if (bix < end_index) logfs_writepage()
146 if (bix > end_index || offset == 0) { logfs_writepage()
H A Dlogfs.h244 * @bix: block index
253 u64 bix; member in struct:logfs_shadow
299 u64 bix; member in struct:logfs_block
311 typedef int write_alias_t(struct super_block *sb, u64 ino, u64 bix,
538 int write_alias_journal(struct super_block *sb, u64 ino, u64 bix,
543 pgoff_t logfs_pack_index(u64 bix, level_t level);
544 void logfs_unpack_index(pgoff_t index, u64 *bix, level_t *level);
546 loff_t bix, long flags, struct shadow_tree *shadow_tree);
551 int logfs_rewrite_block(struct inode *inode, u64 bix, u64 ofs,
553 int logfs_is_valid_block(struct super_block *sb, u64 ofs, u64 ino, u64 bix,
556 u64 logfs_seek_hole(struct inode *inode, u64 bix);
557 u64 logfs_seek_data(struct inode *inode, u64 bix);
573 u64 ino, u64 bix, level_t level);
578 int logfs_exist_block(struct inode *inode, u64 bix);
587 int logfs_segment_read(struct inode *inode, struct page *page, u64 ofs, u64 bix,
H A Dgc.c114 u64 bix, gc_level_t gc_level) logfs_cleanse_block()
120 err = logfs_rewrite_block(inode, bix, ofs, gc_level, 0); logfs_cleanse_block()
130 u64 ofs, ino, bix; logfs_gc_segment() local
165 bix = be64_to_cpu(oh.bix); logfs_gc_segment()
167 valid = logfs_is_valid_block(sb, ofs, ino, bix, gc_level); logfs_gc_segment()
169 logfs_cleanse_block(sb, ofs, ino, bix, gc_level); logfs_gc_segment()
113 logfs_cleanse_block(struct super_block *sb, u64 ofs, u64 ino, u64 bix, gc_level_t gc_level) logfs_cleanse_block() argument
H A Djournal.c485 shadow->ino, shadow->bix, shadow->gc_level, account_shadow()
685 int write_alias_journal(struct super_block *sb, u64 ino, u64 bix, write_alias_journal() argument
693 fill, ino, bix, level, child_no, be64_to_cpu(val)); write_alias_journal()
695 oa[fill].bix = cpu_to_be64(bix); write_alias_journal()
H A Dlogfs_abi.h281 * @bix: block index
290 __be64 bix; member in struct:logfs_object_header
576 __be64 bix; member in struct:logfs_obj_alias
H A Ddir.c84 static int beyond_eof(struct inode *inode, loff_t bix) beyond_eof() argument
86 loff_t pos = bix << inode->i_sb->s_blocksize_bits; beyond_eof()

Completed in 161 milliseconds