[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SEZPR06MB5269DCFA737F179B0F552B01E8BD2@SEZPR06MB5269.apcprd06.prod.outlook.com>
Date: Wed, 16 Apr 2025 13:24:30 +0000
From: 李扬韬 <frank.li@...o.com>
To: "dsterba@...e.cz" <dsterba@...e.cz>, Sun YangKai <sunk67188@...il.com>
CC: "clm@...com" <clm@...com>, "dsterba@...e.com" <dsterba@...e.com>,
"josef@...icpanda.com" <josef@...icpanda.com>, "linux-btrfs@...r.kernel.org"
<linux-btrfs@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "neelx@...e.com" <neelx@...e.com>
Subject:
回复: [PATCH 1/3] btrfs: get rid of path allocation in btrfs_del_inode_extref()
> Also a good point, the path should be in a pristine state, as if it were just allocated. Releasing paths in other functions may want to keep the bits but in this case we're crossing a function boundary and the same assumptions may not be the same.
> Release resets the ->nodes, so what's left is from ->slots until the the end of the structure. And a helper for that would be desirable rather than opencoding that.
IIUC, use btrfs_reset_path instead of btrfs_release_path?
noinline void btrfs_reset_path(struct btrfs_path *p)
{
int i;
for (i = 0; i < BTRFS_MAX_LEVEL; i++) {
if (!p->nodes[i])
continue;
if (p->locks[i])
btrfs_tree_unlock_rw(p->nodes[i], p->locks[i]);
free_extent_buffer(p->nodes[i]);
}
memset(p, 0, sizeof(struct btrfs_path));
}
BTW, I have seen released paths being passed across functions in some other paths.
Should these also be changed to reset paths, or should these flags be cleared in the release path?
Thx,
Yangtao
Powered by blists - more mailing lists