Lines Matching defs:ichdr
48 struct xfs_attr3_icleaf_hdr *ichdr,
51 struct xfs_attr3_icleaf_hdr *ichdr,
294 struct xfs_attr3_icleaf_hdr ichdr;
305 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf);
315 if (ichdr.firstused > mp->m_attr_geo->blksize)
317 if (ichdr.firstused < xfs_attr3_leaf_hdr_size(leaf))
322 if ((char *)&entries[ichdr.count] >
323 (char *)bp->b_addr + ichdr.firstused)
334 for (i = 0, ent = entries; i < ichdr.count; ent++, i++) {
335 fa = xfs_attr3_leaf_verify_entry(mp, buf_end, leaf, &ichdr,
351 if (ichdr.freemap[i].base > mp->m_attr_geo->blksize)
353 if (ichdr.freemap[i].base & 0x3)
355 if (ichdr.freemap[i].size > mp->m_attr_geo->blksize)
357 if (ichdr.freemap[i].size & 0x3)
361 end = (uint32_t)ichdr.freemap[i].base + ichdr.freemap[i].size;
362 if (end < ichdr.freemap[i].base)
1097 struct xfs_attr3_icleaf_hdr ichdr;
1115 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
1148 for (i = 0; i < ichdr.count; entry++, i++) {
1251 struct xfs_attr3_icleaf_hdr ichdr;
1268 memset(&ichdr, 0, sizeof(ichdr));
1269 ichdr.firstused = args->geo->blksize;
1274 ichdr.magic = XFS_ATTR3_LEAF_MAGIC;
1280 ichdr.freemap[0].base = sizeof(struct xfs_attr3_leaf_hdr);
1282 ichdr.magic = XFS_ATTR_LEAF_MAGIC;
1283 ichdr.freemap[0].base = sizeof(struct xfs_attr_leaf_hdr);
1285 ichdr.freemap[0].size = ichdr.firstused - ichdr.freemap[0].base;
1287 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr);
1362 struct xfs_attr3_icleaf_hdr ichdr;
1372 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
1373 ASSERT(args->index >= 0 && args->index <= ichdr.count);
1380 tablesize = (ichdr.count + 1) * sizeof(xfs_attr_leaf_entry_t)
1383 if (tablesize > ichdr.firstused) {
1384 sum += ichdr.freemap[i].size;
1387 if (!ichdr.freemap[i].size)
1390 if (ichdr.freemap[i].base < ichdr.firstused)
1392 if (ichdr.freemap[i].size >= tmp) {
1393 tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, i);
1396 sum += ichdr.freemap[i].size;
1404 if (!ichdr.holes && sum < entsize)
1411 xfs_attr3_leaf_compact(args, &ichdr, bp);
1417 if (ichdr.freemap[0].size < (entsize + sizeof(xfs_attr_leaf_entry_t))) {
1422 tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, 0);
1425 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr);
1438 struct xfs_attr3_icleaf_hdr *ichdr,
1454 ASSERT(args->index >= 0 && args->index <= ichdr->count);
1460 if (args->index < ichdr->count) {
1461 tmp = ichdr->count - args->index;
1467 ichdr->count++;
1473 ASSERT(ichdr->freemap[mapindex].base < args->geo->blksize);
1474 ASSERT((ichdr->freemap[mapindex].base & 0x3) == 0);
1475 ASSERT(ichdr->freemap[mapindex].size >=
1477 ASSERT(ichdr->freemap[mapindex].size < args->geo->blksize);
1478 ASSERT((ichdr->freemap[mapindex].size & 0x3) == 0);
1480 ichdr->freemap[mapindex].size -= xfs_attr_leaf_newentsize(args, &tmp);
1482 entry->nameidx = cpu_to_be16(ichdr->freemap[mapindex].base +
1483 ichdr->freemap[mapindex].size);
1499 ASSERT((args->index == ichdr->count - 1) ||
1535 if (be16_to_cpu(entry->nameidx) < ichdr->firstused)
1536 ichdr->firstused = be16_to_cpu(entry->nameidx);
1538 ASSERT(ichdr->firstused >= ichdr->count * sizeof(xfs_attr_leaf_entry_t)
1540 tmp = (ichdr->count - 1) * sizeof(xfs_attr_leaf_entry_t)
1544 if (ichdr->freemap[i].base == tmp) {
1545 ichdr->freemap[i].base += sizeof(xfs_attr_leaf_entry_t);
1546 ichdr->freemap[i].size -=
1547 min_t(uint16_t, ichdr->freemap[i].size,
1551 ichdr->usedbytes += xfs_attr_leaf_entsize(leaf, args->index);
1962 struct xfs_attr3_icleaf_hdr ichdr;
1980 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr, leaf);
1982 ichdr.count * sizeof(xfs_attr_leaf_entry_t) +
1983 ichdr.usedbytes;
1995 if (ichdr.count == 0) {
2000 forward = (ichdr.forw != 0);
2022 forward = ichdr.forw < ichdr.back;
2026 blkno = ichdr.forw;
2028 blkno = ichdr.back;
2040 ichdr.usedbytes - ichdr2.usedbytes -
2041 ((ichdr.count + ichdr2.count) *
2088 struct xfs_attr3_icleaf_hdr ichdr;
2101 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2103 ASSERT(ichdr.count > 0 && ichdr.count < args->geo->blksize / 8);
2104 ASSERT(args->index >= 0 && args->index < ichdr.count);
2105 ASSERT(ichdr.firstused >= ichdr.count * sizeof(*entry) +
2110 ASSERT(be16_to_cpu(entry->nameidx) >= ichdr.firstused);
2119 tablesize = ichdr.count * sizeof(xfs_attr_leaf_entry_t)
2121 tmp = ichdr.freemap[0].size;
2126 ASSERT(ichdr.freemap[i].base < args->geo->blksize);
2127 ASSERT(ichdr.freemap[i].size < args->geo->blksize);
2128 if (ichdr.freemap[i].base == tablesize) {
2129 ichdr.freemap[i].base -= sizeof(xfs_attr_leaf_entry_t);
2130 ichdr.freemap[i].size += sizeof(xfs_attr_leaf_entry_t);
2133 if (ichdr.freemap[i].base + ichdr.freemap[i].size ==
2136 } else if (ichdr.freemap[i].base ==
2139 } else if (ichdr.freemap[i].size < tmp) {
2140 tmp = ichdr.freemap[i].size;
2151 ichdr.freemap[before].size += entsize;
2152 ichdr.freemap[before].size += ichdr.freemap[after].size;
2153 ichdr.freemap[after].base = 0;
2154 ichdr.freemap[after].size = 0;
2156 ichdr.freemap[before].size += entsize;
2158 ichdr.freemap[after].base = be16_to_cpu(entry->nameidx);
2159 ichdr.freemap[after].size += entsize;
2165 if (ichdr.freemap[smallest].size < entsize) {
2166 ichdr.freemap[smallest].base = be16_to_cpu(entry->nameidx);
2167 ichdr.freemap[smallest].size = entsize;
2174 if (be16_to_cpu(entry->nameidx) == ichdr.firstused)
2183 ichdr.usedbytes -= entsize;
2188 tmp = (ichdr.count - args->index) * sizeof(xfs_attr_leaf_entry_t);
2190 ichdr.count--;
2194 entry = &xfs_attr3_leaf_entryp(leaf)[ichdr.count];
2206 for (i = ichdr.count - 1; i >= 0; entry++, i--) {
2207 ASSERT(be16_to_cpu(entry->nameidx) >= ichdr.firstused);
2213 ichdr.firstused = tmp;
2214 ASSERT(ichdr.firstused != 0);
2216 ichdr.holes = 1; /* mark as needing compaction */
2218 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr);
2227 tmp = ichdr.usedbytes + xfs_attr3_leaf_hdr_size(leaf) +
2228 ichdr.count * sizeof(xfs_attr_leaf_entry_t);
2368 struct xfs_attr3_icleaf_hdr ichdr;
2380 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2382 if (ichdr.count >= args->geo->blksize / 8) {
2391 probe = span = ichdr.count / 2;
2401 if (!(probe >= 0 && (!ichdr.count || probe < ichdr.count))) {
2418 while (probe < ichdr.count &&
2423 if (probe == ichdr.count || be32_to_cpu(entry->hashval) != hashval) {
2431 for (; probe < ichdr.count && (be32_to_cpu(entry->hashval) == hashval);
2475 struct xfs_attr3_icleaf_hdr ichdr;
2481 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2482 ASSERT(ichdr.count < args->geo->blksize / 8);
2483 ASSERT(args->index < ichdr.count);
2663 struct xfs_attr3_icleaf_hdr ichdr;
2667 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, bp->b_addr);
2670 *count = ichdr.count;
2671 if (!ichdr.count)
2673 return be32_to_cpu(entries[ichdr.count - 1].hashval);
2742 struct xfs_attr3_icleaf_hdr ichdr;
2761 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2762 ASSERT(args->index < ichdr.count);
2808 struct xfs_attr3_icleaf_hdr ichdr;
2822 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf);
2823 ASSERT(args->index < ichdr.count);