Lines Matching refs:ib

42 			ih = &icx->ib->index;
117 else if (ictx->ib)
131 static int ntfs_ib_write(struct ntfs_index_context *icx, struct index_block *ib)
133 s64 ret, vcn = le64_to_cpu(ib->index_block_vcn);
137 ret = pre_write_mst_fixup((struct ntfs_record *)ib, icx->block_size);
143 (u8 *)ib, icx->sync_write);
157 err = ntfs_ib_write(icx, icx->ib);
175 ret = ntfs_ib_write(icx, icx->ib);
177 kvfree(icx->ib);
178 icx->ib = NULL;
181 post_write_mst_fixup((struct ntfs_record *)icx->ib);
231 ntfs_ib_write(icx, icx->ib);
232 kvfree(icx->ib);
233 icx->ib = NULL;
456 struct index_block *ib, s64 vcn)
458 u32 ib_size = (unsigned int)le32_to_cpu(ib->index.allocated_size) +
465 if (!ntfs_is_indx_record(ib->magic)) {
472 if (le64_to_cpu(ib->index_block_vcn) != vcn) {
475 (long long)le64_to_cpu(ib->index_block_vcn),
487 if (le32_to_cpu(ib->index.entries_offset) < sizeof(struct index_header)) {
491 if (le32_to_cpu(ib->index.index_length) <=
492 le32_to_cpu(ib->index.entries_offset)) {
496 if (le32_to_cpu(ib->index.allocated_size) <
497 le32_to_cpu(ib->index.index_length)) {
734 struct index_block *ib = NULL;
789 ib = kvzalloc(icx->block_size, GFP_NOFS);
790 if (!ib) {
805 if (ntfs_ib_read(icx, vcn, ib)) {
809 err = ntfs_ie_lookup(key, key_len, icx, &ib->index, &vcn, &ie);
815 icx->ib = ib;
820 if ((ib->index.flags & NODE_MASK) == LEAF_NODE) {
833 kvfree(ib);
849 struct index_block *ib;
854 ib = kvzalloc(ib_size, GFP_NOFS);
855 if (!ib)
858 ib->magic = magic_INDX;
859 ib->usa_ofs = cpu_to_le16(sizeof(struct index_block));
860 ib->usa_count = cpu_to_le16(ib_size / NTFS_BLOCK_SIZE + 1);
862 *(__le16 *)((char *)ib + le16_to_cpu(ib->usa_ofs)) = cpu_to_le16(1);
863 ib->lsn = 0;
864 ib->index_block_vcn = cpu_to_le64(ib_vcn);
865 ib->index.entries_offset = cpu_to_le32((ih_size +
866 le16_to_cpu(ib->usa_count) * 2 + 7) & ~7);
867 ib->index.index_length = 0;
868 ib->index.allocated_size = cpu_to_le32(ib_size -
870 ib->index.flags = node_type;
872 return ib;
1041 struct index_block *ib;
1048 ib = ntfs_ib_alloc(ib_vcn, le32_to_cpu(ir->index_block_size), LEAF_NODE);
1049 if (!ib)
1060 memcpy(ntfs_ie_get_first(&ib->index), ies_start, i);
1062 ib->index.flags = ir->index.flags;
1063 ib->index.index_length = cpu_to_le32(i +
1064 le32_to_cpu(ib->index.entries_offset));
1065 return ib;
1117 static int ntfs_ib_cut_tail(struct ntfs_index_context *icx, struct index_block *ib,
1126 ies_start = (char *)ntfs_ie_get_first(&ib->index);
1127 ies_end = (char *)ntfs_ie_get_end(&ib->index);
1136 ib->index.index_length = cpu_to_le32(((char *)ie - ies_start) +
1137 le16_to_cpu(ie->length) + le32_to_cpu(ib->index.entries_offset));
1139 ret = ntfs_ib_write(icx, ib);
1174 struct index_block *ib = NULL;
1205 ib = ntfs_ir_to_ib(ir, new_ib_vcn);
1206 if (ib == NULL) {
1212 ret = ntfs_ib_write(icx, ib);
1265 kvfree(ib);
1412 static int ntfs_ib_split(struct ntfs_index_context *icx, struct index_block *ib);
1417 struct index_block *ib;
1423 struct index_block *ib;
1430 ib = kvzalloc(icx->block_size, GFP_NOFS);
1431 if (!ib)
1436 err = ntfs_ib_read(icx, old_vcn, ib);
1440 idx_size = le32_to_cpu(ib->index.index_length);
1441 allocated_size = le32_to_cpu(ib->index.allocated_size);
1443 si->ib = ib;
1448 err = ntfs_ih_insert(&ib->index, ie, new_vcn, ntfs_icx_parent_pos(icx));
1452 err = ntfs_ib_write(icx, ib);
1455 kvfree(ib);
1462 * @ib: index block to split
1464 static int ntfs_ib_split(struct ntfs_index_context *icx, struct index_block *ib)
1479 median = ntfs_ie_get_median(&ib->index);
1486 ret = ntfs_ib_copy_tail(icx, ib, median, new_vcn);
1509 ib = si->ib;
1512 kvfree(si->ib);
1520 ret = ntfs_ib_cut_tail(icx, ib, median);
1526 kvfree(si->ib);
1558 ih = &icx->ib->index;
1572 ret = ntfs_ib_split(icx, icx->ib);
1634 struct index_entry *ie, struct index_block *ib)
1664 ret = ntfs_ib_write(icx, ib);
1704 struct index_block *ib)
1716 return ntfs_ih_takeout(icx, ih, ie_prev, ib);
1721 struct index_block *ib = NULL;
1739 ib = kvzalloc(icx->block_size, GFP_NOFS);
1740 if (!ib)
1743 ret = ntfs_ib_read(icx, ntfs_icx_parent_vcn(icx), ib);
1747 parent_ih = &ib->index;
1752 ret = ntfs_ih_takeout(icx, parent_ih, ie, ib);
1766 ret = ntfs_ih_reparent_end(icx, parent_ih, ib);
1768 kvfree(ib);
1776 struct index_block *ib = NULL;
1790 ib = kvzalloc(icx->block_size, GFP_NOFS);
1791 if (!ib)
1799 ret = ntfs_ib_read(icx, vcn, ib);
1803 ie_succ = ntfs_ie_get_first(&ib->index);
1812 if ((ib->index.flags & NODE_MASK) == INDEX_NODE)
1815 if (ntfs_ih_zero_entry(&ib->index)) {
1836 ih = &icx->ib->index;
1851 ret = ntfs_ib_split(icx, icx->ib);
1868 ntfs_ie_delete(&ib->index, ie_succ);
1870 if (ntfs_ih_zero_entry(&ib->index))
1873 ret = ntfs_ib_write(icx, ib);
1878 kvfree(ib);
1897 if (!icx || (!icx->ib && !icx->ir) || ntfs_ie_end(icx->entry)) {
1904 ih = &icx->ib->index;
1972 struct index_block *ib;
1980 ib = kvzalloc(ictx->block_size, GFP_NOFS);
1981 if (!ib)
1990 ictx->ib = ib;
2001 if (!ntfs_ib_read(ictx, vcn, ictx->ib)) {
2002 ictx->entry = ntfs_ie_get_first(&ictx->ib->index);
2031 kfree(ictx->ib);
2032 ictx->ib = NULL;
2048 if (!ntfs_ib_read(ictx, vcn, ictx->ib)) {
2050 &ictx->ib->index,