Lines Matching full:args
47 STATIC int xfs_attr3_leaf_create(struct xfs_da_args *args,
51 struct xfs_da_args *args, int freemap_index);
52 STATIC void xfs_attr3_leaf_compact(struct xfs_da_args *args,
69 STATIC void xfs_attr3_leaf_moveents(struct xfs_da_args *args,
472 * XFS_DA_OP_RECOVERY will be set in args->op_flags.
476 struct xfs_da_args *args, in xfs_attr_match() argument
482 if (args->namelen != namelen) in xfs_attr_match()
484 if (memcmp(args->name, name, namelen) != 0) in xfs_attr_match()
488 if ((args->op_flags & XFS_DA_OP_RECOVERY) && in xfs_attr_match()
489 args->attr_filter == (flags & XFS_ATTR_NSP_ONDISK_MASK)) in xfs_attr_match()
493 if (args->attr_filter != in xfs_attr_match()
501 struct xfs_da_args *args, in xfs_attr_copy_value() argument
508 if (!args->valuelen) { in xfs_attr_copy_value()
509 args->valuelen = valuelen; in xfs_attr_copy_value()
516 if (args->valuelen < valuelen) { in xfs_attr_copy_value()
517 args->valuelen = valuelen; in xfs_attr_copy_value()
521 if (!args->value) { in xfs_attr_copy_value()
522 args->value = kvmalloc(valuelen, GFP_KERNEL | __GFP_NOLOCKDEP); in xfs_attr_copy_value()
523 if (!args->value) in xfs_attr_copy_value()
526 args->valuelen = valuelen; in xfs_attr_copy_value()
529 if (args->rmtblkno) in xfs_attr_copy_value()
530 return xfs_attr_rmtval_get(args); in xfs_attr_copy_value()
540 memcpy(args->value, value, valuelen); in xfs_attr_copy_value()
682 struct xfs_da_args *args) in xfs_attr_shortform_create() argument
684 struct xfs_inode *dp = args->dp; in xfs_attr_shortform_create()
688 trace_xfs_attr_sf_create(args); in xfs_attr_shortform_create()
697 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); in xfs_attr_shortform_create()
702 * args: args containing attribute name and namelen
711 struct xfs_da_args *args, in xfs_attr_sf_findname() argument
722 sf = (struct xfs_attr_shortform *)args->dp->i_af.if_u1.if_data; in xfs_attr_sf_findname()
728 if (!xfs_attr_match(args, sfe->namelen, sfe->nameval, in xfs_attr_sf_findname()
751 struct xfs_da_args *args, in xfs_attr_shortform_add() argument
761 trace_xfs_attr_sf_add(args); in xfs_attr_shortform_add()
763 dp = args->dp; in xfs_attr_shortform_add()
770 if (xfs_attr_sf_findname(args, &sfe, NULL) == -EEXIST) in xfs_attr_shortform_add()
774 size = xfs_attr_sf_entsize_byname(args->namelen, args->valuelen); in xfs_attr_shortform_add()
779 sfe->namelen = args->namelen; in xfs_attr_shortform_add()
780 sfe->valuelen = args->valuelen; in xfs_attr_shortform_add()
781 sfe->flags = args->attr_filter; in xfs_attr_shortform_add()
782 memcpy(sfe->nameval, args->name, args->namelen); in xfs_attr_shortform_add()
783 memcpy(&sfe->nameval[args->namelen], args->value, args->valuelen); in xfs_attr_shortform_add()
786 xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); in xfs_attr_shortform_add()
788 xfs_sbversion_add_attr2(mp, args->trans); in xfs_attr_shortform_add()
812 struct xfs_da_args *args) in xfs_attr_sf_removename() argument
822 trace_xfs_attr_sf_remove(args); in xfs_attr_sf_removename()
824 dp = args->dp; in xfs_attr_sf_removename()
828 error = xfs_attr_sf_findname(args, &sfe, &base); in xfs_attr_sf_removename()
835 if (error == -ENOATTR && (args->op_flags & XFS_DA_OP_RECOVERY)) in xfs_attr_sf_removename()
857 !(args->op_flags & (XFS_DA_OP_ADDNAME | XFS_DA_OP_REPLACE))) { in xfs_attr_sf_removename()
858 xfs_attr_fork_remove(dp, args->trans); in xfs_attr_sf_removename()
864 (args->op_flags & XFS_DA_OP_ADDNAME) || in xfs_attr_sf_removename()
867 xfs_trans_log_inode(args->trans, dp, in xfs_attr_sf_removename()
871 xfs_sbversion_add_attr2(mp, args->trans); in xfs_attr_sf_removename()
881 xfs_attr_shortform_lookup(xfs_da_args_t *args) in xfs_attr_shortform_lookup() argument
888 trace_xfs_attr_sf_lookup(args); in xfs_attr_shortform_lookup()
890 ifp = &args->dp->i_af; in xfs_attr_shortform_lookup()
896 if (xfs_attr_match(args, sfe->namelen, sfe->nameval, in xfs_attr_shortform_lookup()
906 * If args->valuelen is zero, only the length needs to be returned. Unlike a
912 struct xfs_da_args *args) in xfs_attr_shortform_getvalue() argument
918 ASSERT(args->dp->i_af.if_format == XFS_DINODE_FMT_LOCAL); in xfs_attr_shortform_getvalue()
919 sf = (struct xfs_attr_shortform *)args->dp->i_af.if_u1.if_data; in xfs_attr_shortform_getvalue()
923 if (xfs_attr_match(args, sfe->namelen, sfe->nameval, in xfs_attr_shortform_getvalue()
925 return xfs_attr_copy_value(args, in xfs_attr_shortform_getvalue()
926 &sfe->nameval[args->namelen], sfe->valuelen); in xfs_attr_shortform_getvalue()
934 struct xfs_da_args *args) in xfs_attr_shortform_to_leaf() argument
946 trace_xfs_attr_sf_to_leaf(args); in xfs_attr_shortform_to_leaf()
948 dp = args->dp; in xfs_attr_shortform_to_leaf()
958 xfs_bmap_local_to_extents_empty(args->trans, dp, XFS_ATTR_FORK); in xfs_attr_shortform_to_leaf()
961 error = xfs_da_grow_inode(args, &blkno); in xfs_attr_shortform_to_leaf()
966 error = xfs_attr3_leaf_create(args, blkno, &bp); in xfs_attr_shortform_to_leaf()
972 nargs.geo = args->geo; in xfs_attr_shortform_to_leaf()
973 nargs.total = args->total; in xfs_attr_shortform_to_leaf()
975 nargs.trans = args->trans; in xfs_attr_shortform_to_leaf()
1125 struct xfs_da_args *args, in xfs_attr3_leaf_to_shortform() argument
1133 struct xfs_inode *dp = args->dp; in xfs_attr3_leaf_to_shortform()
1138 trace_xfs_attr_leaf_to_sf(args); in xfs_attr3_leaf_to_shortform()
1140 tmpbuffer = kmem_alloc(args->geo->blksize, 0); in xfs_attr3_leaf_to_shortform()
1144 memcpy(tmpbuffer, bp->b_addr, args->geo->blksize); in xfs_attr3_leaf_to_shortform()
1147 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); in xfs_attr3_leaf_to_shortform()
1151 memset(bp->b_addr, 0, args->geo->blksize); in xfs_attr3_leaf_to_shortform()
1156 error = xfs_da_shrink_inode(args, 0, bp); in xfs_attr3_leaf_to_shortform()
1167 if (!(args->op_flags & XFS_DA_OP_REPLACE)) { in xfs_attr3_leaf_to_shortform()
1170 xfs_attr_fork_remove(dp, args->trans); in xfs_attr3_leaf_to_shortform()
1175 xfs_attr_shortform_create(args); in xfs_attr3_leaf_to_shortform()
1181 nargs.geo = args->geo; in xfs_attr3_leaf_to_shortform()
1183 nargs.total = args->total; in xfs_attr3_leaf_to_shortform()
1185 nargs.trans = args->trans; in xfs_attr3_leaf_to_shortform()
1215 struct xfs_da_args *args) in xfs_attr3_leaf_to_node() argument
1222 struct xfs_inode *dp = args->dp; in xfs_attr3_leaf_to_node()
1229 trace_xfs_attr_leaf_to_node(args); in xfs_attr3_leaf_to_node()
1236 error = xfs_da_grow_inode(args, &blkno); in xfs_attr3_leaf_to_node()
1239 error = xfs_attr3_leaf_read(args->trans, dp, 0, &bp1); in xfs_attr3_leaf_to_node()
1243 error = xfs_da_get_buf(args->trans, dp, blkno, &bp2, XFS_ATTR_FORK); in xfs_attr3_leaf_to_node()
1248 xfs_trans_buf_set_type(args->trans, bp2, XFS_BLFT_ATTR_LEAF_BUF); in xfs_attr3_leaf_to_node()
1250 memcpy(bp2->b_addr, bp1->b_addr, args->geo->blksize); in xfs_attr3_leaf_to_node()
1255 xfs_trans_log_buf(args->trans, bp2, 0, args->geo->blksize - 1); in xfs_attr3_leaf_to_node()
1260 error = xfs_da3_node_create(args, 0, 1, &bp1, XFS_ATTR_FORK); in xfs_attr3_leaf_to_node()
1267 xfs_attr3_leaf_hdr_from_disk(args->geo, &icleafhdr, leaf); in xfs_attr3_leaf_to_node()
1275 xfs_trans_log_buf(args->trans, bp1, 0, args->geo->blksize - 1); in xfs_attr3_leaf_to_node()
1291 struct xfs_da_args *args, in xfs_attr3_leaf_create() argument
1297 struct xfs_inode *dp = args->dp; in xfs_attr3_leaf_create()
1302 trace_xfs_attr_leaf_create(args); in xfs_attr3_leaf_create()
1304 error = xfs_da_get_buf(args->trans, args->dp, blkno, &bp, in xfs_attr3_leaf_create()
1309 xfs_trans_buf_set_type(args->trans, bp, XFS_BLFT_ATTR_LEAF_BUF); in xfs_attr3_leaf_create()
1311 memset(leaf, 0, args->geo->blksize); in xfs_attr3_leaf_create()
1314 ichdr.firstused = args->geo->blksize; in xfs_attr3_leaf_create()
1332 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); in xfs_attr3_leaf_create()
1333 xfs_trans_log_buf(args->trans, bp, 0, args->geo->blksize - 1); in xfs_attr3_leaf_create()
1351 trace_xfs_attr_leaf_split(state->args); in xfs_attr3_leaf_split()
1357 error = xfs_da_grow_inode(state->args, &blkno); in xfs_attr3_leaf_split()
1360 error = xfs_attr3_leaf_create(state->args, blkno, &newblk->bp); in xfs_attr3_leaf_split()
1383 trace_xfs_attr_leaf_add_old(state->args); in xfs_attr3_leaf_split()
1384 error = xfs_attr3_leaf_add(oldblk->bp, state->args); in xfs_attr3_leaf_split()
1386 trace_xfs_attr_leaf_add_new(state->args); in xfs_attr3_leaf_split()
1387 error = xfs_attr3_leaf_add(newblk->bp, state->args); in xfs_attr3_leaf_split()
1404 struct xfs_da_args *args) in xfs_attr3_leaf_add() argument
1414 trace_xfs_attr_leaf_add(args); in xfs_attr3_leaf_add()
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()
1419 entsize = xfs_attr_leaf_newentsize(args, NULL); in xfs_attr3_leaf_add()
1438 tmp = xfs_attr3_leaf_add_work(bp, &ichdr, args, i); in xfs_attr3_leaf_add()
1456 xfs_attr3_leaf_compact(args, &ichdr, bp); 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()
1471 xfs_trans_log_buf(args->trans, bp, in xfs_attr3_leaf_add()
1484 struct xfs_da_args *args, in xfs_attr3_leaf_add_work() argument
1495 trace_xfs_attr_leaf_add_work(args); in xfs_attr3_leaf_add_work()
1499 ASSERT(args->index >= 0 && args->index <= ichdr->count); in xfs_attr3_leaf_add_work()
1504 entry = &xfs_attr3_leaf_entryp(leaf)[args->index]; 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()
1509 xfs_trans_log_buf(args->trans, bp, in xfs_attr3_leaf_add_work()
1517 mp = args->trans->t_mountp; in xfs_attr3_leaf_add_work()
1518 ASSERT(ichdr->freemap[mapindex].base < args->geo->blksize); in xfs_attr3_leaf_add_work()
1521 xfs_attr_leaf_newentsize(args, NULL)); in xfs_attr3_leaf_add_work()
1522 ASSERT(ichdr->freemap[mapindex].size < args->geo->blksize); in xfs_attr3_leaf_add_work()
1525 ichdr->freemap[mapindex].size -= xfs_attr_leaf_newentsize(args, &tmp); in xfs_attr3_leaf_add_work()
1529 entry->hashval = cpu_to_be32(args->hashval); in xfs_attr3_leaf_add_work()
1530 entry->flags = args->attr_filter; in xfs_attr3_leaf_add_work()
1533 if (args->op_flags & XFS_DA_OP_REPLACE) { in xfs_attr3_leaf_add_work()
1534 if (!(args->op_flags & XFS_DA_OP_LOGGED)) in xfs_attr3_leaf_add_work()
1536 if ((args->blkno2 == args->blkno) && in xfs_attr3_leaf_add_work()
1537 (args->index2 <= args->index)) { in xfs_attr3_leaf_add_work()
1538 args->index2++; in xfs_attr3_leaf_add_work()
1541 xfs_trans_log_buf(args->trans, bp, in xfs_attr3_leaf_add_work()
1543 ASSERT((args->index == 0) || in xfs_attr3_leaf_add_work()
1545 ASSERT((args->index == ichdr->count - 1) || in xfs_attr3_leaf_add_work()
1556 name_loc = xfs_attr3_leaf_name_local(leaf, args->index); in xfs_attr3_leaf_add_work()
1557 name_loc->namelen = args->namelen; in xfs_attr3_leaf_add_work()
1558 name_loc->valuelen = cpu_to_be16(args->valuelen); in xfs_attr3_leaf_add_work()
1559 memcpy((char *)name_loc->nameval, args->name, args->namelen); in xfs_attr3_leaf_add_work()
1560 memcpy((char *)&name_loc->nameval[args->namelen], args->value, in xfs_attr3_leaf_add_work()
1563 name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index); in xfs_attr3_leaf_add_work()
1564 name_rmt->namelen = args->namelen; in xfs_attr3_leaf_add_work()
1565 memcpy((char *)name_rmt->name, args->name, args->namelen); in xfs_attr3_leaf_add_work()
1570 args->rmtblkno = 1; in xfs_attr3_leaf_add_work()
1571 args->rmtblkcnt = xfs_attr3_rmt_blocks(mp, args->valuelen); in xfs_attr3_leaf_add_work()
1572 args->rmtvaluelen = args->valuelen; in xfs_attr3_leaf_add_work()
1574 xfs_trans_log_buf(args->trans, bp, in xfs_attr3_leaf_add_work()
1575 XFS_DA_LOGRANGE(leaf, xfs_attr3_leaf_name(leaf, args->index), in xfs_attr3_leaf_add_work()
1576 xfs_attr_leaf_entsize(leaf, args->index))); in xfs_attr3_leaf_add_work()
1597 ichdr->usedbytes += xfs_attr_leaf_entsize(leaf, args->index); in xfs_attr3_leaf_add_work()
1606 struct xfs_da_args *args, in xfs_attr3_leaf_compact() argument
1613 struct xfs_trans *trans = args->trans; in xfs_attr3_leaf_compact()
1616 trace_xfs_attr_leaf_compact(args); in xfs_attr3_leaf_compact()
1618 tmpbuffer = kmem_alloc(args->geo->blksize, 0); in xfs_attr3_leaf_compact()
1619 memcpy(tmpbuffer, bp->b_addr, args->geo->blksize); in xfs_attr3_leaf_compact()
1620 memset(bp->b_addr, 0, args->geo->blksize); in xfs_attr3_leaf_compact()
1633 ichdr_dst->firstused = args->geo->blksize; in xfs_attr3_leaf_compact()
1642 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf_dst, ichdr_dst); in xfs_attr3_leaf_compact()
1648 xfs_attr3_leaf_moveents(args, leaf_src, &ichdr_src, 0, in xfs_attr3_leaf_compact()
1654 xfs_trans_log_buf(trans, bp, 0, args->geo->blksize - 1); in xfs_attr3_leaf_compact()
1706 * This code adjusts the args->index/blkno and args->index2/blkno2 fields
1717 struct xfs_da_args *args; in xfs_attr3_leaf_rebalance() local
1737 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr1, leaf1); in xfs_attr3_leaf_rebalance()
1738 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr2, leaf2); in xfs_attr3_leaf_rebalance()
1740 args = state->args; in xfs_attr3_leaf_rebalance()
1742 trace_xfs_attr_leaf_rebalance(args); in xfs_attr3_leaf_rebalance()
1794 xfs_attr3_leaf_compact(args, &ichdr2, blk2->bp); in xfs_attr3_leaf_rebalance()
1799 xfs_attr3_leaf_moveents(args, leaf1, &ichdr1, in xfs_attr3_leaf_rebalance()
1823 xfs_attr3_leaf_compact(args, &ichdr1, blk1->bp); in xfs_attr3_leaf_rebalance()
1828 xfs_attr3_leaf_moveents(args, leaf2, &ichdr2, 0, leaf1, &ichdr1, in xfs_attr3_leaf_rebalance()
1832 xfs_attr3_leaf_hdr_to_disk(state->args->geo, leaf1, &ichdr1); in xfs_attr3_leaf_rebalance()
1833 xfs_attr3_leaf_hdr_to_disk(state->args->geo, leaf2, &ichdr2); in xfs_attr3_leaf_rebalance()
1834 xfs_trans_log_buf(args->trans, blk1->bp, 0, args->geo->blksize - 1); in xfs_attr3_leaf_rebalance()
1835 xfs_trans_log_buf(args->trans, blk2->bp, 0, args->geo->blksize - 1); in xfs_attr3_leaf_rebalance()
1860 args->index = args->index2 = blk2->index; in xfs_attr3_leaf_rebalance()
1861 args->blkno = args->blkno2 = blk2->blkno; in xfs_attr3_leaf_rebalance()
1864 args->index = blk1->index; in xfs_attr3_leaf_rebalance()
1865 args->blkno = blk1->blkno; in xfs_attr3_leaf_rebalance()
1866 args->index2 = 0; in xfs_attr3_leaf_rebalance()
1867 args->blkno2 = blk2->blkno; in xfs_attr3_leaf_rebalance()
1875 args->index = blk2->index; in xfs_attr3_leaf_rebalance()
1876 args->blkno = blk2->blkno; in xfs_attr3_leaf_rebalance()
1883 args->index2 = blk2->index; in xfs_attr3_leaf_rebalance()
1884 args->blkno2 = blk2->blkno; in xfs_attr3_leaf_rebalance()
1889 args->index = args->index2 = blk1->index; in xfs_attr3_leaf_rebalance()
1890 args->blkno = args->blkno2 = blk1->blkno; in xfs_attr3_leaf_rebalance()
1930 xfs_attr_leaf_newentsize(state->args, NULL); in xfs_attr3_leaf_figure_balance()
1932 lastdelta = state->args->geo->blksize; in xfs_attr3_leaf_figure_balance()
1942 xfs_attr_leaf_newentsize(state->args, NULL); in xfs_attr3_leaf_figure_balance()
1978 xfs_attr_leaf_newentsize(state->args, NULL); in xfs_attr3_leaf_figure_balance()
2017 trace_xfs_attr_leaf_toosmall(state->args); in xfs_attr3_leaf_toosmall()
2026 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr, leaf); in xfs_attr3_leaf_toosmall()
2030 if (bytes > (state->args->geo->blksize >> 1)) { in xfs_attr3_leaf_toosmall()
2077 error = xfs_attr3_leaf_read(state->args->trans, state->args->dp, in xfs_attr3_leaf_toosmall()
2082 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr2, bp->b_addr); in xfs_attr3_leaf_toosmall()
2084 bytes = state->args->geo->blksize - in xfs_attr3_leaf_toosmall()
2085 (state->args->geo->blksize >> 2) - in xfs_attr3_leaf_toosmall()
2091 xfs_trans_brelse(state->args->trans, bp); in xfs_attr3_leaf_toosmall()
2131 struct xfs_da_args *args) in xfs_attr3_leaf_remove() argument
2144 trace_xfs_attr_leaf_remove(args); in xfs_attr3_leaf_remove()
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()
2154 entry = &xfs_attr3_leaf_entryp(leaf)[args->index]; in xfs_attr3_leaf_remove()
2157 ASSERT(be16_to_cpu(entry->nameidx) < args->geo->blksize); in xfs_attr3_leaf_remove()
2170 entsize = xfs_attr_leaf_entsize(leaf, args->index); 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()
2228 memset(xfs_attr3_leaf_name(leaf, args->index), 0, entsize); in xfs_attr3_leaf_remove()
2230 xfs_trans_log_buf(args->trans, bp, in xfs_attr3_leaf_remove()
2231 XFS_DA_LOGRANGE(leaf, xfs_attr3_leaf_name(leaf, args->index), in xfs_attr3_leaf_remove()
2234 tmp = (ichdr.count - args->index) * sizeof(xfs_attr_leaf_entry_t); in xfs_attr3_leaf_remove()
2237 xfs_trans_log_buf(args->trans, bp, in xfs_attr3_leaf_remove()
2250 tmp = args->geo->blksize; in xfs_attr3_leaf_remove()
2254 ASSERT(be16_to_cpu(entry->nameidx) < args->geo->blksize); in xfs_attr3_leaf_remove()
2264 xfs_attr3_leaf_hdr_to_disk(args->geo, leaf, &ichdr); in xfs_attr3_leaf_remove()
2265 xfs_trans_log_buf(args->trans, bp, in xfs_attr3_leaf_remove()
2276 return tmp < args->geo->magicpct; /* leaf is < 37% full */ in xfs_attr3_leaf_remove()
2294 trace_xfs_attr_leaf_unbalance(state->args); in xfs_attr3_leaf_unbalance()
2298 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &drophdr, drop_leaf); in xfs_attr3_leaf_unbalance()
2299 xfs_attr3_leaf_hdr_from_disk(state->args->geo, &savehdr, save_leaf); in xfs_attr3_leaf_unbalance()
2319 xfs_attr3_leaf_moveents(state->args, in xfs_attr3_leaf_unbalance()
2324 xfs_attr3_leaf_moveents(state->args, in xfs_attr3_leaf_unbalance()
2337 tmp_leaf = kmem_zalloc(state->args->geo->blksize, 0); in xfs_attr3_leaf_unbalance()
2350 tmphdr.firstused = state->args->geo->blksize; in xfs_attr3_leaf_unbalance()
2353 xfs_attr3_leaf_hdr_to_disk(state->args->geo, tmp_leaf, &tmphdr); in xfs_attr3_leaf_unbalance()
2357 xfs_attr3_leaf_moveents(state->args, in xfs_attr3_leaf_unbalance()
2361 xfs_attr3_leaf_moveents(state->args, in xfs_attr3_leaf_unbalance()
2366 xfs_attr3_leaf_moveents(state->args, in xfs_attr3_leaf_unbalance()
2370 xfs_attr3_leaf_moveents(state->args, in xfs_attr3_leaf_unbalance()
2375 memcpy(save_leaf, tmp_leaf, state->args->geo->blksize); in xfs_attr3_leaf_unbalance()
2380 xfs_attr3_leaf_hdr_to_disk(state->args->geo, save_leaf, &savehdr); in xfs_attr3_leaf_unbalance()
2381 xfs_trans_log_buf(state->args->trans, save_blk->bp, 0, in xfs_attr3_leaf_unbalance()
2382 state->args->geo->blksize - 1); in xfs_attr3_leaf_unbalance()
2402 * Return in args->index the index into the entry[] array of either
2406 * Don't change the args->value unless we find the attribute.
2411 struct xfs_da_args *args) in xfs_attr3_leaf_lookup_int() argument
2423 trace_xfs_attr_leaf_lookup(args); in xfs_attr3_leaf_lookup_int()
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()
2436 hashval = args->hashval; in xfs_attr3_leaf_lookup_int()
2470 args->index = probe; in xfs_attr3_leaf_lookup_int()
2484 if (!xfs_attr_match(args, name_loc->namelen, in xfs_attr3_leaf_lookup_int()
2487 args->index = probe; in xfs_attr3_leaf_lookup_int()
2491 if (!xfs_attr_match(args, name_rmt->namelen, in xfs_attr3_leaf_lookup_int()
2494 args->index = probe; in xfs_attr3_leaf_lookup_int()
2495 args->rmtvaluelen = be32_to_cpu(name_rmt->valuelen); in xfs_attr3_leaf_lookup_int()
2496 args->rmtblkno = be32_to_cpu(name_rmt->valueblk); in xfs_attr3_leaf_lookup_int()
2497 args->rmtblkcnt = xfs_attr3_rmt_blocks( in xfs_attr3_leaf_lookup_int()
2498 args->dp->i_mount, in xfs_attr3_leaf_lookup_int()
2499 args->rmtvaluelen); in xfs_attr3_leaf_lookup_int()
2503 args->index = probe; in xfs_attr3_leaf_lookup_int()
2511 * If args->valuelen is zero, only the length needs to be returned. Unlike a
2518 struct xfs_da_args *args) in xfs_attr3_leaf_getvalue() argument
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()
2531 entry = &xfs_attr3_leaf_entryp(leaf)[args->index]; in xfs_attr3_leaf_getvalue()
2533 name_loc = xfs_attr3_leaf_name_local(leaf, args->index); in xfs_attr3_leaf_getvalue()
2534 ASSERT(name_loc->namelen == args->namelen); in xfs_attr3_leaf_getvalue()
2535 ASSERT(memcmp(args->name, name_loc->nameval, args->namelen) == 0); in xfs_attr3_leaf_getvalue()
2536 return xfs_attr_copy_value(args, in xfs_attr3_leaf_getvalue()
2537 &name_loc->nameval[args->namelen], in xfs_attr3_leaf_getvalue()
2541 name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index); in xfs_attr3_leaf_getvalue()
2542 ASSERT(name_rmt->namelen == args->namelen); in xfs_attr3_leaf_getvalue()
2543 ASSERT(memcmp(args->name, name_rmt->name, args->namelen) == 0); in xfs_attr3_leaf_getvalue()
2544 args->rmtvaluelen = be32_to_cpu(name_rmt->valuelen); in xfs_attr3_leaf_getvalue()
2545 args->rmtblkno = be32_to_cpu(name_rmt->valueblk); in xfs_attr3_leaf_getvalue()
2546 args->rmtblkcnt = xfs_attr3_rmt_blocks(args->dp->i_mount, in xfs_attr3_leaf_getvalue()
2547 args->rmtvaluelen); in xfs_attr3_leaf_getvalue()
2548 return xfs_attr_copy_value(args, NULL, args->rmtvaluelen); in xfs_attr3_leaf_getvalue()
2562 struct xfs_da_args *args, in xfs_attr3_leaf_moveents() argument
2589 ASSERT(ichdr_s->count > 0 && ichdr_s->count < args->geo->blksize / 8); in xfs_attr3_leaf_moveents()
2592 ASSERT(ichdr_d->count < args->geo->blksize / 8); in xfs_attr3_leaf_moveents()
2644 <= args->geo->blksize); in xfs_attr3_leaf_moveents()
2648 <= args->geo->blksize); in xfs_attr3_leaf_moveents()
2669 ((char *)leaf_s + args->geo->blksize)); in xfs_attr3_leaf_moveents()
2684 ((char *)leaf_s + args->geo->blksize)); in xfs_attr3_leaf_moveents()
2754 struct xfs_da_args *args, in xfs_attr_leaf_newentsize() argument
2759 size = xfs_attr_leaf_entsize_local(args->namelen, args->valuelen); in xfs_attr_leaf_newentsize()
2760 if (size < xfs_attr_leaf_entsize_local_max(args->geo->blksize)) { in xfs_attr_leaf_newentsize()
2767 return xfs_attr_leaf_entsize_remote(args->namelen); in xfs_attr_leaf_newentsize()
2780 struct xfs_da_args *args) in xfs_attr3_leaf_clearflag() argument
2794 trace_xfs_attr_leaf_clearflag(args); in xfs_attr3_leaf_clearflag()
2798 error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, &bp); in xfs_attr3_leaf_clearflag()
2803 entry = &xfs_attr3_leaf_entryp(leaf)[args->index]; in xfs_attr3_leaf_clearflag()
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()
2809 ASSERT(args->index >= 0); in xfs_attr3_leaf_clearflag()
2812 name_loc = xfs_attr3_leaf_name_local(leaf, args->index); in xfs_attr3_leaf_clearflag()
2816 name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index); in xfs_attr3_leaf_clearflag()
2820 ASSERT(be32_to_cpu(entry->hashval) == args->hashval); in xfs_attr3_leaf_clearflag()
2821 ASSERT(namelen == args->namelen); in xfs_attr3_leaf_clearflag()
2822 ASSERT(memcmp(name, args->name, namelen) == 0); in xfs_attr3_leaf_clearflag()
2826 xfs_trans_log_buf(args->trans, bp, in xfs_attr3_leaf_clearflag()
2829 if (args->rmtblkno) { in xfs_attr3_leaf_clearflag()
2831 name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index); in xfs_attr3_leaf_clearflag()
2832 name_rmt->valueblk = cpu_to_be32(args->rmtblkno); in xfs_attr3_leaf_clearflag()
2833 name_rmt->valuelen = cpu_to_be32(args->rmtvaluelen); in xfs_attr3_leaf_clearflag()
2834 xfs_trans_log_buf(args->trans, bp, in xfs_attr3_leaf_clearflag()
2846 struct xfs_da_args *args) in xfs_attr3_leaf_setflag() argument
2857 trace_xfs_attr_leaf_setflag(args); in xfs_attr3_leaf_setflag()
2862 error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, &bp); in xfs_attr3_leaf_setflag()
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()
2870 ASSERT(args->index >= 0); in xfs_attr3_leaf_setflag()
2872 entry = &xfs_attr3_leaf_entryp(leaf)[args->index]; in xfs_attr3_leaf_setflag()
2876 xfs_trans_log_buf(args->trans, bp, in xfs_attr3_leaf_setflag()
2879 name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index); in xfs_attr3_leaf_setflag()
2882 xfs_trans_log_buf(args->trans, bp, in xfs_attr3_leaf_setflag()
2891 * given by args->blkno/index and set the INCOMPLETE flag on the leaf
2892 * entry given by args->blkno2/index2.
2898 struct xfs_da_args *args) in xfs_attr3_leaf_flipflags() argument
2916 trace_xfs_attr_leaf_flipflags(args); in xfs_attr3_leaf_flipflags()
2921 error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, &bp1); in xfs_attr3_leaf_flipflags()
2928 if (args->blkno2 != args->blkno) { in xfs_attr3_leaf_flipflags()
2929 error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno2, in xfs_attr3_leaf_flipflags()
2938 entry1 = &xfs_attr3_leaf_entryp(leaf1)[args->index]; in xfs_attr3_leaf_flipflags()
2941 entry2 = &xfs_attr3_leaf_entryp(leaf2)[args->index2]; in xfs_attr3_leaf_flipflags()
2944 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr1, leaf1); in xfs_attr3_leaf_flipflags()
2945 ASSERT(args->index < ichdr1.count); in xfs_attr3_leaf_flipflags()
2946 ASSERT(args->index >= 0); in xfs_attr3_leaf_flipflags()
2948 xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr2, leaf2); in xfs_attr3_leaf_flipflags()
2949 ASSERT(args->index2 < ichdr2.count); in xfs_attr3_leaf_flipflags()
2950 ASSERT(args->index2 >= 0); in xfs_attr3_leaf_flipflags()
2953 name_loc = xfs_attr3_leaf_name_local(leaf1, args->index); in xfs_attr3_leaf_flipflags()
2957 name_rmt = xfs_attr3_leaf_name_remote(leaf1, args->index); in xfs_attr3_leaf_flipflags()
2962 name_loc = xfs_attr3_leaf_name_local(leaf2, args->index2); in xfs_attr3_leaf_flipflags()
2966 name_rmt = xfs_attr3_leaf_name_remote(leaf2, args->index2); in xfs_attr3_leaf_flipflags()
2979 xfs_trans_log_buf(args->trans, bp1, in xfs_attr3_leaf_flipflags()
2981 if (args->rmtblkno) { in xfs_attr3_leaf_flipflags()
2983 name_rmt = xfs_attr3_leaf_name_remote(leaf1, args->index); in xfs_attr3_leaf_flipflags()
2984 name_rmt->valueblk = cpu_to_be32(args->rmtblkno); in xfs_attr3_leaf_flipflags()
2985 name_rmt->valuelen = cpu_to_be32(args->rmtvaluelen); in xfs_attr3_leaf_flipflags()
2986 xfs_trans_log_buf(args->trans, bp1, in xfs_attr3_leaf_flipflags()
2991 xfs_trans_log_buf(args->trans, bp2, in xfs_attr3_leaf_flipflags()
2994 name_rmt = xfs_attr3_leaf_name_remote(leaf2, args->index2); in xfs_attr3_leaf_flipflags()
2997 xfs_trans_log_buf(args->trans, bp2, in xfs_attr3_leaf_flipflags()