Lines Matching refs:ichdr
51 struct xfs_attr3_icleaf_hdr *ichdr,
54 struct xfs_attr3_icleaf_hdr *ichdr,
242 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_verify() local
249 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf); in xfs_attr3_leaf_verify()
254 if (ichdr.magic != XFS_ATTR3_LEAF_MAGIC) in xfs_attr3_leaf_verify()
264 if (ichdr.magic != XFS_ATTR_LEAF_MAGIC) in xfs_attr3_leaf_verify()
272 if (!xfs_log_in_recovery(mp) && ichdr.count == 0) in xfs_attr3_leaf_verify()
279 if (ichdr.firstused > mp->m_attr_geo->blksize) in xfs_attr3_leaf_verify()
281 if (ichdr.firstused < xfs_attr3_leaf_hdr_size(leaf)) in xfs_attr3_leaf_verify()
286 if ((char *)&entries[ichdr.count] > in xfs_attr3_leaf_verify()
287 (char *)bp->b_addr + ichdr.firstused) in xfs_attr3_leaf_verify()
298 if (ichdr.freemap[i].base > mp->m_attr_geo->blksize) in xfs_attr3_leaf_verify()
300 if (ichdr.freemap[i].base & 0x3) in xfs_attr3_leaf_verify()
302 if (ichdr.freemap[i].size > mp->m_attr_geo->blksize) in xfs_attr3_leaf_verify()
304 if (ichdr.freemap[i].size & 0x3) in xfs_attr3_leaf_verify()
306 end = ichdr.freemap[i].base + ichdr.freemap[i].size; in xfs_attr3_leaf_verify()
307 if (end < ichdr.freemap[i].base) in xfs_attr3_leaf_verify()
982 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_to_shortform() local
1000 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_to_shortform()
1033 for (i = 0; i < ichdr.count; entry++, i++) { in xfs_attr3_leaf_to_shortform()
1138 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_create() local
1155 memset(&ichdr, 0, sizeof(ichdr)); in xfs_attr3_leaf_create()
1156 ichdr.firstused = args->geo->blksize; in xfs_attr3_leaf_create()
1161 ichdr.magic = XFS_ATTR3_LEAF_MAGIC; in xfs_attr3_leaf_create()
1167 ichdr.freemap[0].base = sizeof(struct xfs_attr3_leaf_hdr); in xfs_attr3_leaf_create()
1169 ichdr.magic = XFS_ATTR_LEAF_MAGIC; in xfs_attr3_leaf_create()
1170 ichdr.freemap[0].base = sizeof(struct xfs_attr_leaf_hdr); in xfs_attr3_leaf_create()
1172 ichdr.freemap[0].size = ichdr.firstused - ichdr.freemap[0].base; in xfs_attr3_leaf_create()
1174 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); in xfs_attr3_leaf_create()
1249 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_add() local
1259 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_add()
1260 ASSERT(args->index >= 0 && args->index <= ichdr.count); in xfs_attr3_leaf_add()
1267 tablesize = (ichdr.count + 1) * sizeof(xfs_attr_leaf_entry_t) in xfs_attr3_leaf_add()
1270 if (tablesize > ichdr.firstused) { in xfs_attr3_leaf_add()
1271 sum += ichdr.freemap[i].size; in xfs_attr3_leaf_add()
1274 if (!ichdr.freemap[i].size) in xfs_attr3_leaf_add()
1277 if (ichdr.freemap[i].base < ichdr.firstused) in xfs_attr3_leaf_add()
1279 if (ichdr.freemap[i].size >= tmp) { in xfs_attr3_leaf_add()
1280 tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, i); in xfs_attr3_leaf_add()
1283 sum += ichdr.freemap[i].size; in xfs_attr3_leaf_add()
1291 if (!ichdr.holes && sum < entsize) in xfs_attr3_leaf_add()
1298 xfs_attr3_leaf_compact(args, &ichdr, bp); in xfs_attr3_leaf_add()
1304 if (ichdr.freemap[0].size < (entsize + sizeof(xfs_attr_leaf_entry_t))) { in xfs_attr3_leaf_add()
1309 tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, 0); in xfs_attr3_leaf_add()
1312 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); in xfs_attr3_leaf_add()
1325 struct xfs_attr3_icleaf_hdr *ichdr, in xfs_attr3_leaf_add_work() argument
1341 ASSERT(args->index >= 0 && args->index <= ichdr->count); in xfs_attr3_leaf_add_work()
1347 if (args->index < ichdr->count) { in xfs_attr3_leaf_add_work()
1348 tmp = ichdr->count - args->index; in xfs_attr3_leaf_add_work()
1354 ichdr->count++; in xfs_attr3_leaf_add_work()
1360 ASSERT(ichdr->freemap[mapindex].base < args->geo->blksize); in xfs_attr3_leaf_add_work()
1361 ASSERT((ichdr->freemap[mapindex].base & 0x3) == 0); in xfs_attr3_leaf_add_work()
1362 ASSERT(ichdr->freemap[mapindex].size >= in xfs_attr3_leaf_add_work()
1364 ASSERT(ichdr->freemap[mapindex].size < args->geo->blksize); in xfs_attr3_leaf_add_work()
1365 ASSERT((ichdr->freemap[mapindex].size & 0x3) == 0); in xfs_attr3_leaf_add_work()
1367 ichdr->freemap[mapindex].size -= xfs_attr_leaf_newentsize(args, &tmp); in xfs_attr3_leaf_add_work()
1369 entry->nameidx = cpu_to_be16(ichdr->freemap[mapindex].base + in xfs_attr3_leaf_add_work()
1370 ichdr->freemap[mapindex].size); in xfs_attr3_leaf_add_work()
1385 ASSERT((args->index == ichdr->count - 1) || in xfs_attr3_leaf_add_work()
1421 if (be16_to_cpu(entry->nameidx) < ichdr->firstused) in xfs_attr3_leaf_add_work()
1422 ichdr->firstused = be16_to_cpu(entry->nameidx); in xfs_attr3_leaf_add_work()
1424 ASSERT(ichdr->firstused >= ichdr->count * sizeof(xfs_attr_leaf_entry_t) in xfs_attr3_leaf_add_work()
1426 tmp = (ichdr->count - 1) * sizeof(xfs_attr_leaf_entry_t) in xfs_attr3_leaf_add_work()
1430 if (ichdr->freemap[i].base == tmp) { in xfs_attr3_leaf_add_work()
1431 ichdr->freemap[i].base += sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_add_work()
1432 ichdr->freemap[i].size -= sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_add_work()
1435 ichdr->usedbytes += xfs_attr_leaf_entsize(leaf, args->index); in xfs_attr3_leaf_add_work()
1846 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_toosmall() local
1864 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr, leaf); in xfs_attr3_leaf_toosmall()
1866 ichdr.count * sizeof(xfs_attr_leaf_entry_t) + in xfs_attr3_leaf_toosmall()
1867 ichdr.usedbytes; in xfs_attr3_leaf_toosmall()
1879 if (ichdr.count == 0) { in xfs_attr3_leaf_toosmall()
1884 forward = (ichdr.forw != 0); in xfs_attr3_leaf_toosmall()
1906 forward = ichdr.forw < ichdr.back; in xfs_attr3_leaf_toosmall()
1910 blkno = ichdr.forw; in xfs_attr3_leaf_toosmall()
1912 blkno = ichdr.back; in xfs_attr3_leaf_toosmall()
1924 ichdr.usedbytes - ichdr2.usedbytes - in xfs_attr3_leaf_toosmall()
1925 ((ichdr.count + ichdr2.count) * in xfs_attr3_leaf_toosmall()
1972 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_remove() local
1985 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_remove()
1987 ASSERT(ichdr.count > 0 && ichdr.count < args->geo->blksize / 8); in xfs_attr3_leaf_remove()
1988 ASSERT(args->index >= 0 && args->index < ichdr.count); in xfs_attr3_leaf_remove()
1989 ASSERT(ichdr.firstused >= ichdr.count * sizeof(*entry) + in xfs_attr3_leaf_remove()
1994 ASSERT(be16_to_cpu(entry->nameidx) >= ichdr.firstused); in xfs_attr3_leaf_remove()
2003 tablesize = ichdr.count * sizeof(xfs_attr_leaf_entry_t) in xfs_attr3_leaf_remove()
2005 tmp = ichdr.freemap[0].size; in xfs_attr3_leaf_remove()
2010 ASSERT(ichdr.freemap[i].base < args->geo->blksize); in xfs_attr3_leaf_remove()
2011 ASSERT(ichdr.freemap[i].size < args->geo->blksize); in xfs_attr3_leaf_remove()
2012 if (ichdr.freemap[i].base == tablesize) { in xfs_attr3_leaf_remove()
2013 ichdr.freemap[i].base -= sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_remove()
2014 ichdr.freemap[i].size += sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_remove()
2017 if (ichdr.freemap[i].base + ichdr.freemap[i].size == in xfs_attr3_leaf_remove()
2020 } else if (ichdr.freemap[i].base == in xfs_attr3_leaf_remove()
2023 } else if (ichdr.freemap[i].size < tmp) { in xfs_attr3_leaf_remove()
2024 tmp = ichdr.freemap[i].size; in xfs_attr3_leaf_remove()
2035 ichdr.freemap[before].size += entsize; in xfs_attr3_leaf_remove()
2036 ichdr.freemap[before].size += ichdr.freemap[after].size; in xfs_attr3_leaf_remove()
2037 ichdr.freemap[after].base = 0; in xfs_attr3_leaf_remove()
2038 ichdr.freemap[after].size = 0; in xfs_attr3_leaf_remove()
2040 ichdr.freemap[before].size += entsize; in xfs_attr3_leaf_remove()
2042 ichdr.freemap[after].base = be16_to_cpu(entry->nameidx); in xfs_attr3_leaf_remove()
2043 ichdr.freemap[after].size += entsize; in xfs_attr3_leaf_remove()
2049 if (ichdr.freemap[smallest].size < entsize) { in xfs_attr3_leaf_remove()
2050 ichdr.freemap[smallest].base = be16_to_cpu(entry->nameidx); in xfs_attr3_leaf_remove()
2051 ichdr.freemap[smallest].size = entsize; in xfs_attr3_leaf_remove()
2058 if (be16_to_cpu(entry->nameidx) == ichdr.firstused) in xfs_attr3_leaf_remove()
2067 ichdr.usedbytes -= entsize; in xfs_attr3_leaf_remove()
2072 tmp = (ichdr.count - args->index) * sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_remove()
2074 ichdr.count--; in xfs_attr3_leaf_remove()
2078 entry = &xfs_attr3_leaf_entryp(leaf)[ichdr.count]; in xfs_attr3_leaf_remove()
2090 for (i = ichdr.count - 1; i >= 0; entry++, i--) { in xfs_attr3_leaf_remove()
2091 ASSERT(be16_to_cpu(entry->nameidx) >= ichdr.firstused); in xfs_attr3_leaf_remove()
2097 ichdr.firstused = tmp; in xfs_attr3_leaf_remove()
2098 ASSERT(ichdr.firstused != 0); in xfs_attr3_leaf_remove()
2100 ichdr.holes = 1; /* mark as needing compaction */ in xfs_attr3_leaf_remove()
2102 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); in xfs_attr3_leaf_remove()
2111 tmp = ichdr.usedbytes + xfs_attr3_leaf_hdr_size(leaf) + in xfs_attr3_leaf_remove()
2112 ichdr.count * sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_remove()
2252 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_lookup_int() local
2264 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_lookup_int()
2266 if (ichdr.count >= args->geo->blksize / 8) in xfs_attr3_leaf_lookup_int()
2273 probe = span = ichdr.count / 2; in xfs_attr3_leaf_lookup_int()
2283 if (!(probe >= 0 && (!ichdr.count || probe < ichdr.count))) in xfs_attr3_leaf_lookup_int()
2296 while (probe < ichdr.count && in xfs_attr3_leaf_lookup_int()
2301 if (probe == ichdr.count || be32_to_cpu(entry->hashval) != hashval) { in xfs_attr3_leaf_lookup_int()
2309 for (; probe < ichdr.count && (be32_to_cpu(entry->hashval) == hashval); in xfs_attr3_leaf_lookup_int()
2365 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_getvalue() local
2372 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_getvalue()
2373 ASSERT(ichdr.count < args->geo->blksize / 8); in xfs_attr3_leaf_getvalue()
2374 ASSERT(args->index < ichdr.count); in xfs_attr3_leaf_getvalue()
2571 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr_leaf_lasthash() local
2575 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, bp->b_addr); in xfs_attr_leaf_lasthash()
2578 *count = ichdr.count; in xfs_attr_leaf_lasthash()
2579 if (!ichdr.count) in xfs_attr_leaf_lasthash()
2581 return be32_to_cpu(entries[ichdr.count - 1].hashval); in xfs_attr_leaf_lasthash()
2650 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_clearflag() local
2669 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_clearflag()
2670 ASSERT(args->index < ichdr.count); in xfs_attr3_leaf_clearflag()
2719 struct xfs_attr3_icleaf_hdr ichdr; in xfs_attr3_leaf_setflag() local
2733 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_setflag()
2734 ASSERT(args->index < ichdr.count); in xfs_attr3_leaf_setflag()