[PATCH 12/23] Add ngnfs_dir_lookup() and debugfs lookup command

Zach Brown zab at zabbo.net
Wed Apr 9 14:50:54 PDT 2025


On Fri, Apr 04, 2025 at 08:45:28PM +0200, Valerie Aurora wrote:
> Add ngnfs_dir_lookup() to return ngnfs directory entry information and
> the associated debugfs lookup command for debugging purposes.


> +static int lookup_dirent(struct ngnfs_fs_info *nfi, struct ngnfs_transaction *txn,
> +			 struct ngnfs_inode_txn_ref *dir, struct dirent_args *da)
> +{
> +	struct ngnfs_btree_key key;
> +	struct ngnfs_btree_key last;
> +	int ret;
> +
> +	ret = lookup_dots(nfi, txn, dir, da);
> +	if (ret == 0)
> +		goto out;
> +
> +	init_dirent_key(&key, da->hash);
> +	init_dirent_key(&last, da->hash | NGNFS_DIRENT_COLL_BIT);
> +
> +	ret = ngnfs_btree_read_iter(nfi, txn, &dir->ninode->dirents, &key, NULL, &last,
> +				    fill_lookup_rd, da);
> +	if (ret < 0)
> +		goto out;
> +
> +	if (da->ig.ino == 0)
> +		ret = -ENOENT;
> +out:
> +	return ret;
> +}

So I'm hoping we can have this whare the dirent read iter wrapper with
readdir and we can remove lookup_dots().

- z



More information about the ngnfs-devel mailing list