mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: 李扬韬 <frank.li@vivo.com>
To: "dsterba@suse.cz" <dsterba@suse.cz>, Sun YangKai <sunk67188@gmail.com>
Cc: "clm@fb.com" <clm@fb.com>, "dsterba@suse.com" <dsterba@suse.com>,
	"josef@toxicpanda.com" <josef@toxicpanda.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"neelx@suse.com" <neelx@suse.com>
Subject: 回复: [PATCH 1/3] btrfs: get rid of path allocation in btrfs_del_inode_extref()
Date: Wed, 16 Apr 2025 13:24:30 +0000	[thread overview]
Message-ID: <SEZPR06MB5269DCFA737F179B0F552B01E8BD2@SEZPR06MB5269.apcprd06.prod.outlook.com> (raw)
In-Reply-To: <20250415155637.GG16750@suse.cz>



> 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

  reply	other threads:[~2025-04-16 13:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15  3:38 Yangtao Li
2025-04-15  3:38 ` [PATCH 2/3] btrfs: get rid of path allocation in btrfs_insert_inode_extref() Yangtao Li
2025-04-15  3:38 ` [PATCH 3/3] btrfs: use BTRFS_PATH_AUTO_FREE in btrfs_truncate_inode_items() Yangtao Li
2025-04-15 14:45 ` [PATCH 1/3] btrfs: get rid of path allocation in btrfs_del_inode_extref() Sun YangKai
2025-04-15 15:56   ` David Sterba
2025-04-16 13:24     ` 李扬韬 [this message]
2025-04-16 13:37       ` Filipe Manana
2025-04-16 19:11         ` David Sterba
2025-04-16 19:40           ` Filipe Manana
2025-04-17 14:15             ` 回复: " 李扬韬
2025-04-17 14:36               ` Filipe Manana
2025-04-16 19:14       ` 回复: " David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SEZPR06MB5269DCFA737F179B0F552B01E8BD2@SEZPR06MB5269.apcprd06.prod.outlook.com \
    --to=frank.li@vivo.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neelx@suse.com \
    --cc=sunk67188@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®