Lines Matching refs:ichdr
50 struct xfs_attr3_icleaf_hdr *ichdr,
53 struct xfs_attr3_icleaf_hdr *ichdr,
313 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_verify() local
324 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf); in xfs_attr3_leaf_verify()
334 if (ichdr.firstused > mp->m_attr_geo->blksize) in xfs_attr3_leaf_verify()
336 if (ichdr.firstused < xfs_attr3_leaf_hdr_size(leaf)) in xfs_attr3_leaf_verify()
341 if ((char *)&entries[ichdr.count] > in xfs_attr3_leaf_verify()
342 (char *)bp->b_addr + ichdr.firstused) in xfs_attr3_leaf_verify()
353 for (i = 0, ent = entries; i < ichdr.count; ent++, i++) { in xfs_attr3_leaf_verify()
354 fa = xfs_attr3_leaf_verify_entry(mp, buf_end, leaf, &ichdr, in xfs_attr3_leaf_verify()
370 if (ichdr.freemap[i].base > mp->m_attr_geo->blksize) in xfs_attr3_leaf_verify()
372 if (ichdr.freemap[i].base & 0x3) in xfs_attr3_leaf_verify()
374 if (ichdr.freemap[i].size > mp->m_attr_geo->blksize) in xfs_attr3_leaf_verify()
376 if (ichdr.freemap[i].size & 0x3) in xfs_attr3_leaf_verify()
380 end = (uint32_t)ichdr.freemap[i].base + ichdr.freemap[i].size; in xfs_attr3_leaf_verify()
381 if (end < ichdr.freemap[i].base) in xfs_attr3_leaf_verify()
1129 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_to_shortform() local
1147 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_to_shortform()
1188 for (i = 0; i < ichdr.count; entry++, i++) { in xfs_attr3_leaf_to_shortform()
1296 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_create() local
1313 memset(&ichdr, 0, sizeof(ichdr)); in xfs_attr3_leaf_create()
1314 ichdr.firstused = args->geo->blksize; in xfs_attr3_leaf_create()
1319 ichdr.magic = XFS_ATTR3_LEAF_MAGIC; in xfs_attr3_leaf_create()
1325 ichdr.freemap[0].base = sizeof(struct xfs_attr3_leaf_hdr); in xfs_attr3_leaf_create()
1327 ichdr.magic = XFS_ATTR_LEAF_MAGIC; in xfs_attr3_leaf_create()
1328 ichdr.freemap[0].base = sizeof(struct xfs_attr_leaf_hdr); in xfs_attr3_leaf_create()
1330 ichdr.freemap[0].size = ichdr.firstused - ichdr.freemap[0].base; in xfs_attr3_leaf_create()
1332 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); in xfs_attr3_leaf_create()
1407 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_add() local
1417 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_add()
1418 ASSERT(args->index >= 0 && args->index <= ichdr.count); in xfs_attr3_leaf_add()
1425 tablesize = (ichdr.count + 1) * sizeof(xfs_attr_leaf_entry_t) in xfs_attr3_leaf_add()
1428 if (tablesize > ichdr.firstused) { in xfs_attr3_leaf_add()
1429 sum += ichdr.freemap[i].size; in xfs_attr3_leaf_add()
1432 if (!ichdr.freemap[i].size) in xfs_attr3_leaf_add()
1435 if (ichdr.freemap[i].base < ichdr.firstused) in xfs_attr3_leaf_add()
1437 if (ichdr.freemap[i].size >= tmp) { in xfs_attr3_leaf_add()
1438 tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, i); in xfs_attr3_leaf_add()
1441 sum += ichdr.freemap[i].size; in xfs_attr3_leaf_add()
1449 if (!ichdr.holes && sum < entsize) in xfs_attr3_leaf_add()
1456 xfs_attr3_leaf_compact(args, &ichdr, bp); in xfs_attr3_leaf_add()
1462 if (ichdr.freemap[0].size < (entsize + sizeof(xfs_attr_leaf_entry_t))) { in xfs_attr3_leaf_add()
1467 tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, 0); in xfs_attr3_leaf_add()
1470 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); in xfs_attr3_leaf_add()
1483 struct xfs_attr3_icleaf_hdr *ichdr, in xfs_attr3_leaf_add_work() argument
1499 ASSERT(args->index >= 0 && args->index <= ichdr->count); in xfs_attr3_leaf_add_work()
1505 if (args->index < ichdr->count) { in xfs_attr3_leaf_add_work()
1506 tmp = ichdr->count - args->index; in xfs_attr3_leaf_add_work()
1512 ichdr->count++; in xfs_attr3_leaf_add_work()
1518 ASSERT(ichdr->freemap[mapindex].base < args->geo->blksize); in xfs_attr3_leaf_add_work()
1519 ASSERT((ichdr->freemap[mapindex].base & 0x3) == 0); in xfs_attr3_leaf_add_work()
1520 ASSERT(ichdr->freemap[mapindex].size >= in xfs_attr3_leaf_add_work()
1522 ASSERT(ichdr->freemap[mapindex].size < args->geo->blksize); in xfs_attr3_leaf_add_work()
1523 ASSERT((ichdr->freemap[mapindex].size & 0x3) == 0); in xfs_attr3_leaf_add_work()
1525 ichdr->freemap[mapindex].size -= xfs_attr_leaf_newentsize(args, &tmp); in xfs_attr3_leaf_add_work()
1527 entry->nameidx = cpu_to_be16(ichdr->freemap[mapindex].base + in xfs_attr3_leaf_add_work()
1528 ichdr->freemap[mapindex].size); in xfs_attr3_leaf_add_work()
1545 ASSERT((args->index == ichdr->count - 1) || in xfs_attr3_leaf_add_work()
1581 if (be16_to_cpu(entry->nameidx) < ichdr->firstused) in xfs_attr3_leaf_add_work()
1582 ichdr->firstused = be16_to_cpu(entry->nameidx); in xfs_attr3_leaf_add_work()
1584 ASSERT(ichdr->firstused >= ichdr->count * sizeof(xfs_attr_leaf_entry_t) in xfs_attr3_leaf_add_work()
1586 tmp = (ichdr->count - 1) * sizeof(xfs_attr_leaf_entry_t) in xfs_attr3_leaf_add_work()
1590 if (ichdr->freemap[i].base == tmp) { in xfs_attr3_leaf_add_work()
1591 ichdr->freemap[i].base += sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_add_work()
1592 ichdr->freemap[i].size -= in xfs_attr3_leaf_add_work()
1593 min_t(uint16_t, ichdr->freemap[i].size, in xfs_attr3_leaf_add_work()
1597 ichdr->usedbytes += xfs_attr_leaf_entsize(leaf, args->index); in xfs_attr3_leaf_add_work()
2008 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_toosmall() local
2026 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr, leaf); in xfs_attr3_leaf_toosmall()
2028 ichdr.count * sizeof(xfs_attr_leaf_entry_t) + in xfs_attr3_leaf_toosmall()
2029 ichdr.usedbytes; in xfs_attr3_leaf_toosmall()
2041 if (ichdr.count == 0) { in xfs_attr3_leaf_toosmall()
2046 forward = (ichdr.forw != 0); in xfs_attr3_leaf_toosmall()
2068 forward = ichdr.forw < ichdr.back; in xfs_attr3_leaf_toosmall()
2072 blkno = ichdr.forw; in xfs_attr3_leaf_toosmall()
2074 blkno = ichdr.back; in xfs_attr3_leaf_toosmall()
2086 ichdr.usedbytes - ichdr2.usedbytes - in xfs_attr3_leaf_toosmall()
2087 ((ichdr.count + ichdr2.count) * in xfs_attr3_leaf_toosmall()
2134 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_remove() local
2147 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_remove()
2149 ASSERT(ichdr.count > 0 && ichdr.count < args->geo->blksize / 8); in xfs_attr3_leaf_remove()
2150 ASSERT(args->index >= 0 && args->index < ichdr.count); in xfs_attr3_leaf_remove()
2151 ASSERT(ichdr.firstused >= ichdr.count * sizeof(*entry) + in xfs_attr3_leaf_remove()
2156 ASSERT(be16_to_cpu(entry->nameidx) >= ichdr.firstused); in xfs_attr3_leaf_remove()
2165 tablesize = ichdr.count * sizeof(xfs_attr_leaf_entry_t) in xfs_attr3_leaf_remove()
2167 tmp = ichdr.freemap[0].size; in xfs_attr3_leaf_remove()
2172 ASSERT(ichdr.freemap[i].base < args->geo->blksize); in xfs_attr3_leaf_remove()
2173 ASSERT(ichdr.freemap[i].size < args->geo->blksize); in xfs_attr3_leaf_remove()
2174 if (ichdr.freemap[i].base == tablesize) { in xfs_attr3_leaf_remove()
2175 ichdr.freemap[i].base -= sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_remove()
2176 ichdr.freemap[i].size += sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_remove()
2179 if (ichdr.freemap[i].base + ichdr.freemap[i].size == in xfs_attr3_leaf_remove()
2182 } else if (ichdr.freemap[i].base == in xfs_attr3_leaf_remove()
2185 } else if (ichdr.freemap[i].size < tmp) { in xfs_attr3_leaf_remove()
2186 tmp = ichdr.freemap[i].size; in xfs_attr3_leaf_remove()
2197 ichdr.freemap[before].size += entsize; in xfs_attr3_leaf_remove()
2198 ichdr.freemap[before].size += ichdr.freemap[after].size; in xfs_attr3_leaf_remove()
2199 ichdr.freemap[after].base = 0; in xfs_attr3_leaf_remove()
2200 ichdr.freemap[after].size = 0; in xfs_attr3_leaf_remove()
2202 ichdr.freemap[before].size += entsize; in xfs_attr3_leaf_remove()
2204 ichdr.freemap[after].base = be16_to_cpu(entry->nameidx); in xfs_attr3_leaf_remove()
2205 ichdr.freemap[after].size += entsize; in xfs_attr3_leaf_remove()
2211 if (ichdr.freemap[smallest].size < entsize) { in xfs_attr3_leaf_remove()
2212 ichdr.freemap[smallest].base = be16_to_cpu(entry->nameidx); in xfs_attr3_leaf_remove()
2213 ichdr.freemap[smallest].size = entsize; in xfs_attr3_leaf_remove()
2220 if (be16_to_cpu(entry->nameidx) == ichdr.firstused) in xfs_attr3_leaf_remove()
2229 ichdr.usedbytes -= entsize; in xfs_attr3_leaf_remove()
2234 tmp = (ichdr.count - args->index) * sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_remove()
2236 ichdr.count--; in xfs_attr3_leaf_remove()
2240 entry = &xfs_attr3_leaf_entryp(leaf)[ichdr.count]; in xfs_attr3_leaf_remove()
2252 for (i = ichdr.count - 1; i >= 0; entry++, i--) { in xfs_attr3_leaf_remove()
2253 ASSERT(be16_to_cpu(entry->nameidx) >= ichdr.firstused); in xfs_attr3_leaf_remove()
2259 ichdr.firstused = tmp; in xfs_attr3_leaf_remove()
2260 ASSERT(ichdr.firstused != 0); in xfs_attr3_leaf_remove()
2262 ichdr.holes = 1; /* mark as needing compaction */ in xfs_attr3_leaf_remove()
2264 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); in xfs_attr3_leaf_remove()
2273 tmp = ichdr.usedbytes + xfs_attr3_leaf_hdr_size(leaf) + in xfs_attr3_leaf_remove()
2274 ichdr.count * sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_remove()
2414 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_lookup_int() local
2426 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_lookup_int()
2428 if (ichdr.count >= args->geo->blksize / 8) { in xfs_attr3_leaf_lookup_int()
2437 probe = span = ichdr.count / 2; in xfs_attr3_leaf_lookup_int()
2447 if (!(probe >= 0 && (!ichdr.count || probe < ichdr.count))) { in xfs_attr3_leaf_lookup_int()
2464 while (probe < ichdr.count && in xfs_attr3_leaf_lookup_int()
2469 if (probe == ichdr.count || be32_to_cpu(entry->hashval) != hashval) { in xfs_attr3_leaf_lookup_int()
2477 for (; probe < ichdr.count && (be32_to_cpu(entry->hashval) == hashval); in xfs_attr3_leaf_lookup_int()
2521 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_getvalue() local
2527 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_getvalue()
2528 ASSERT(ichdr.count < args->geo->blksize / 8); in xfs_attr3_leaf_getvalue()
2529 ASSERT(args->index < ichdr.count); in xfs_attr3_leaf_getvalue()
2709 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr_leaf_lasthash() local
2713 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, bp->b_addr); in xfs_attr_leaf_lasthash()
2716 *count = ichdr.count; in xfs_attr_leaf_lasthash()
2717 if (!ichdr.count) in xfs_attr_leaf_lasthash()
2719 return be32_to_cpu(entries[ichdr.count - 1].hashval); in xfs_attr_leaf_lasthash()
2788 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_clearflag() local
2807 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_clearflag()
2808 ASSERT(args->index < ichdr.count); in xfs_attr3_leaf_clearflag()
2854 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_setflag() local
2868 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_setflag()
2869 ASSERT(args->index < ichdr.count); in xfs_attr3_leaf_setflag()