H A D | xfs_attr_leaf.c | 63 struct xfs_attr3_icleaf_hdr *ichdr, 66 struct xfs_attr3_icleaf_hdr *ichdr, 256 struct xfs_attr3_icleaf_hdr ichdr; xfs_attr3_leaf_verify() local 258 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, leaf); xfs_attr3_leaf_verify() 263 if (ichdr.magic != XFS_ATTR3_LEAF_MAGIC) xfs_attr3_leaf_verify() 273 if (ichdr.magic != XFS_ATTR_LEAF_MAGIC) xfs_attr3_leaf_verify() 276 if (ichdr.count == 0) xfs_attr3_leaf_verify() 878 struct xfs_attr3_icleaf_hdr ichdr; xfs_attr3_leaf_to_shortform() local 896 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); xfs_attr3_leaf_to_shortform() 931 for (i = 0; i < ichdr.count; entry++, i++) { xfs_attr3_leaf_to_shortform() 1036 struct xfs_attr3_icleaf_hdr ichdr; xfs_attr3_leaf_create() local 1053 memset(&ichdr, 0, sizeof(ichdr)); xfs_attr3_leaf_create() 1054 ichdr.firstused = args->geo->blksize; xfs_attr3_leaf_create() 1059 ichdr.magic = XFS_ATTR3_LEAF_MAGIC; xfs_attr3_leaf_create() 1065 ichdr.freemap[0].base = sizeof(struct xfs_attr3_leaf_hdr); xfs_attr3_leaf_create() 1067 ichdr.magic = XFS_ATTR_LEAF_MAGIC; xfs_attr3_leaf_create() 1068 ichdr.freemap[0].base = sizeof(struct xfs_attr_leaf_hdr); xfs_attr3_leaf_create() 1070 ichdr.freemap[0].size = ichdr.firstused - ichdr.freemap[0].base; xfs_attr3_leaf_create() 1072 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); xfs_attr3_leaf_create() 1147 struct xfs_attr3_icleaf_hdr ichdr; xfs_attr3_leaf_add() local 1157 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); xfs_attr3_leaf_add() 1158 ASSERT(args->index >= 0 && args->index <= ichdr.count); xfs_attr3_leaf_add() 1165 tablesize = (ichdr.count + 1) * sizeof(xfs_attr_leaf_entry_t) xfs_attr3_leaf_add() 1168 if (tablesize > ichdr.firstused) { xfs_attr3_leaf_add() 1169 sum += ichdr.freemap[i].size; xfs_attr3_leaf_add() 1172 if (!ichdr.freemap[i].size) xfs_attr3_leaf_add() 1175 if (ichdr.freemap[i].base < ichdr.firstused) xfs_attr3_leaf_add() 1177 if (ichdr.freemap[i].size >= tmp) { xfs_attr3_leaf_add() 1178 tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, i); xfs_attr3_leaf_add() 1181 sum += ichdr.freemap[i].size; xfs_attr3_leaf_add() 1189 if (!ichdr.holes && sum < entsize) xfs_attr3_leaf_add() 1196 xfs_attr3_leaf_compact(args, &ichdr, bp); xfs_attr3_leaf_add() 1202 if (ichdr.freemap[0].size < (entsize + sizeof(xfs_attr_leaf_entry_t))) { xfs_attr3_leaf_add() 1207 tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, 0); xfs_attr3_leaf_add() 1210 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); xfs_attr3_leaf_add() 1223 struct xfs_attr3_icleaf_hdr *ichdr, xfs_attr3_leaf_add_work() 1239 ASSERT(args->index >= 0 && args->index <= ichdr->count); xfs_attr3_leaf_add_work() 1245 if (args->index < ichdr->count) { xfs_attr3_leaf_add_work() 1246 tmp = ichdr->count - args->index; xfs_attr3_leaf_add_work() 1252 ichdr->count++; xfs_attr3_leaf_add_work() 1258 ASSERT(ichdr->freemap[mapindex].base < args->geo->blksize); xfs_attr3_leaf_add_work() 1259 ASSERT((ichdr->freemap[mapindex].base & 0x3) == 0); xfs_attr3_leaf_add_work() 1260 ASSERT(ichdr->freemap[mapindex].size >= xfs_attr3_leaf_add_work() 1262 ASSERT(ichdr->freemap[mapindex].size < args->geo->blksize); xfs_attr3_leaf_add_work() 1263 ASSERT((ichdr->freemap[mapindex].size & 0x3) == 0); xfs_attr3_leaf_add_work() 1265 ichdr->freemap[mapindex].size -= xfs_attr_leaf_newentsize(args, &tmp); xfs_attr3_leaf_add_work() 1267 entry->nameidx = cpu_to_be16(ichdr->freemap[mapindex].base + xfs_attr3_leaf_add_work() 1268 ichdr->freemap[mapindex].size); xfs_attr3_leaf_add_work() 1283 ASSERT((args->index == ichdr->count - 1) || xfs_attr3_leaf_add_work() 1319 if (be16_to_cpu(entry->nameidx) < ichdr->firstused) xfs_attr3_leaf_add_work() 1320 ichdr->firstused = be16_to_cpu(entry->nameidx); xfs_attr3_leaf_add_work() 1322 ASSERT(ichdr->firstused >= ichdr->count * sizeof(xfs_attr_leaf_entry_t) xfs_attr3_leaf_add_work() 1324 tmp = (ichdr->count - 1) * sizeof(xfs_attr_leaf_entry_t) xfs_attr3_leaf_add_work() 1328 if (ichdr->freemap[i].base == tmp) { xfs_attr3_leaf_add_work() 1329 ichdr->freemap[i].base += sizeof(xfs_attr_leaf_entry_t); xfs_attr3_leaf_add_work() 1330 ichdr->freemap[i].size -= sizeof(xfs_attr_leaf_entry_t); xfs_attr3_leaf_add_work() 1333 ichdr->usedbytes += xfs_attr_leaf_entsize(leaf, args->index); xfs_attr3_leaf_add_work() 1751 struct xfs_attr3_icleaf_hdr ichdr; xfs_attr3_leaf_toosmall() local 1769 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr, leaf); xfs_attr3_leaf_toosmall() 1771 ichdr.count * sizeof(xfs_attr_leaf_entry_t) + xfs_attr3_leaf_toosmall() 1772 ichdr.usedbytes; xfs_attr3_leaf_toosmall() 1784 if (ichdr.count == 0) { xfs_attr3_leaf_toosmall() 1789 forward = (ichdr.forw != 0); xfs_attr3_leaf_toosmall() 1811 forward = ichdr.forw < ichdr.back; xfs_attr3_leaf_toosmall() 1815 blkno = ichdr.forw; xfs_attr3_leaf_toosmall() 1817 blkno = ichdr.back; xfs_attr3_leaf_toosmall() 1829 ichdr.usedbytes - ichdr2.usedbytes - xfs_attr3_leaf_toosmall() 1830 ((ichdr.count + ichdr2.count) * xfs_attr3_leaf_toosmall() 1877 struct xfs_attr3_icleaf_hdr ichdr; xfs_attr3_leaf_remove() local 1890 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); xfs_attr3_leaf_remove() 1892 ASSERT(ichdr.count > 0 && ichdr.count < args->geo->blksize / 8); xfs_attr3_leaf_remove() 1893 ASSERT(args->index >= 0 && args->index < ichdr.count); xfs_attr3_leaf_remove() 1894 ASSERT(ichdr.firstused >= ichdr.count * sizeof(*entry) + xfs_attr3_leaf_remove() 1899 ASSERT(be16_to_cpu(entry->nameidx) >= ichdr.firstused); xfs_attr3_leaf_remove() 1908 tablesize = ichdr.count * sizeof(xfs_attr_leaf_entry_t) xfs_attr3_leaf_remove() 1910 tmp = ichdr.freemap[0].size; xfs_attr3_leaf_remove() 1915 ASSERT(ichdr.freemap[i].base < args->geo->blksize); xfs_attr3_leaf_remove() 1916 ASSERT(ichdr.freemap[i].size < args->geo->blksize); xfs_attr3_leaf_remove() 1917 if (ichdr.freemap[i].base == tablesize) { xfs_attr3_leaf_remove() 1918 ichdr.freemap[i].base -= sizeof(xfs_attr_leaf_entry_t); xfs_attr3_leaf_remove() 1919 ichdr.freemap[i].size += sizeof(xfs_attr_leaf_entry_t); xfs_attr3_leaf_remove() 1922 if (ichdr.freemap[i].base + ichdr.freemap[i].size == xfs_attr3_leaf_remove() 1925 } else if (ichdr.freemap[i].base == xfs_attr3_leaf_remove() 1928 } else if (ichdr.freemap[i].size < tmp) { xfs_attr3_leaf_remove() 1929 tmp = ichdr.freemap[i].size; xfs_attr3_leaf_remove() 1940 ichdr.freemap[before].size += entsize; xfs_attr3_leaf_remove() 1941 ichdr.freemap[before].size += ichdr.freemap[after].size; xfs_attr3_leaf_remove() 1942 ichdr.freemap[after].base = 0; xfs_attr3_leaf_remove() 1943 ichdr.freemap[after].size = 0; xfs_attr3_leaf_remove() 1945 ichdr.freemap[before].size += entsize; xfs_attr3_leaf_remove() 1947 ichdr.freemap[after].base = be16_to_cpu(entry->nameidx); xfs_attr3_leaf_remove() 1948 ichdr.freemap[after].size += entsize; xfs_attr3_leaf_remove() 1954 if (ichdr.freemap[smallest].size < entsize) { xfs_attr3_leaf_remove() 1955 ichdr.freemap[smallest].base = be16_to_cpu(entry->nameidx); xfs_attr3_leaf_remove() 1956 ichdr.freemap[smallest].size = entsize; xfs_attr3_leaf_remove() 1963 if (be16_to_cpu(entry->nameidx) == ichdr.firstused) xfs_attr3_leaf_remove() 1972 ichdr.usedbytes -= entsize; xfs_attr3_leaf_remove() 1977 tmp = (ichdr.count - args->index) * sizeof(xfs_attr_leaf_entry_t); xfs_attr3_leaf_remove() 1979 ichdr.count--; xfs_attr3_leaf_remove() 1983 entry = &xfs_attr3_leaf_entryp(leaf)[ichdr.count]; xfs_attr3_leaf_remove() 1995 for (i = ichdr.count - 1; i >= 0; entry++, i--) { xfs_attr3_leaf_remove() 1996 ASSERT(be16_to_cpu(entry->nameidx) >= ichdr.firstused); xfs_attr3_leaf_remove() 2002 ichdr.firstused = tmp; xfs_attr3_leaf_remove() 2003 ASSERT(ichdr.firstused != 0); xfs_attr3_leaf_remove() 2005 ichdr.holes = 1; /* mark as needing compaction */ xfs_attr3_leaf_remove() 2007 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); xfs_attr3_leaf_remove() 2016 tmp = ichdr.usedbytes + xfs_attr3_leaf_hdr_size(leaf) + xfs_attr3_leaf_remove() 2017 ichdr.count * sizeof(xfs_attr_leaf_entry_t); xfs_attr3_leaf_remove() 2157 struct xfs_attr3_icleaf_hdr ichdr; xfs_attr3_leaf_lookup_int() local 2169 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); xfs_attr3_leaf_lookup_int() 2171 ASSERT(ichdr.count < args->geo->blksize / 8); xfs_attr3_leaf_lookup_int() 2177 probe = span = ichdr.count / 2; xfs_attr3_leaf_lookup_int() 2187 ASSERT(probe >= 0 && (!ichdr.count || probe < ichdr.count)); xfs_attr3_leaf_lookup_int() 2198 while (probe < ichdr.count && xfs_attr3_leaf_lookup_int() 2203 if (probe == ichdr.count || be32_to_cpu(entry->hashval) != hashval) { xfs_attr3_leaf_lookup_int() 2211 for (; probe < ichdr.count && (be32_to_cpu(entry->hashval) == hashval); xfs_attr3_leaf_lookup_int() 2267 struct xfs_attr3_icleaf_hdr ichdr; xfs_attr3_leaf_getvalue() local 2274 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); xfs_attr3_leaf_getvalue() 2275 ASSERT(ichdr.count < args->geo->blksize / 8); xfs_attr3_leaf_getvalue() 2276 ASSERT(args->index < ichdr.count); xfs_attr3_leaf_getvalue() 2473 struct xfs_attr3_icleaf_hdr ichdr; xfs_attr_leaf_lasthash() local 2477 xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr, bp->b_addr); xfs_attr_leaf_lasthash() 2480 *count = ichdr.count; xfs_attr_leaf_lasthash() 2481 if (!ichdr.count) xfs_attr_leaf_lasthash() 2483 return be32_to_cpu(entries[ichdr.count - 1].hashval); xfs_attr_leaf_lasthash() 2552 struct xfs_attr3_icleaf_hdr ichdr; xfs_attr3_leaf_clearflag() local 2571 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); xfs_attr3_leaf_clearflag() 2572 ASSERT(args->index < ichdr.count); xfs_attr3_leaf_clearflag() 2621 struct xfs_attr3_icleaf_hdr ichdr; xfs_attr3_leaf_setflag() local 2635 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); xfs_attr3_leaf_setflag() 2636 ASSERT(args->index < ichdr.count); xfs_attr3_leaf_setflag() 1221 xfs_attr3_leaf_add_work( struct xfs_buf *bp, struct xfs_attr3_icleaf_hdr *ichdr, struct xfs_da_args *args, int mapindex) xfs_attr3_leaf_add_work() argument
|