H A D | readwrite.c | 23 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
|