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