[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aP_5eW_GHwXebeyq@agluck-desk3>
Date: Mon, 27 Oct 2025 16:00:09 -0700
From: "Luck, Tony" <tony.luck@...el.com>
To: Reinette Chatre <reinette.chatre@...el.com>
CC: Fenghua Yu <fenghuay@...dia.com>, Maciej Wieczor-Retman
<maciej.wieczor-retman@...el.com>, Peter Newman <peternewman@...gle.com>,
James Morse <james.morse@....com>, Babu Moger <babu.moger@....com>, "Drew
Fustini" <dfustini@...libre.com>, Dave Martin <Dave.Martin@....com>, Chen Yu
<yu.c.chen@...el.com>, <x86@...nel.org>, <linux-kernel@...r.kernel.org>,
<patches@...ts.linux.dev>
Subject: Re: [PATCH v12 20/31] fs/resctrl: Refactor mkdir_mondata_subdir()
On Thu, Oct 23, 2025 at 10:45:06AM -0700, Reinette Chatre wrote:
> > + sprintf(name, "mon_sub_%s_%02d", r->name, hdr->id);
> > + ckn = kernfs_create_dir(kn, name, parent_kn->mode, prgrp);
>
> Noting here that kn was created earlier with mode of parent_kn->mode. It thus looks to me like
> above can also be written as:
> ckn = kernfs_create_dir(kn, name, kn->mode, prgrp);
>
> The reason I mention this is that this patch adds a third copy of a very similar code snippet
> (kernfs_create_dir(), rdtgroup_kn_set_ugid(), mon_add_all_files()) that looks like a good
> candidate for a helper?
I looked at this. But the helper needs a lot of arguments to cover these
three cases. Something like:
static struct kernfs_node *make_and_fill_mondir(struct kernfs_node *parent_kn,
char *name, umode_t mode,
struct rdtgroup *prgrp,
struct rdt_domain_hdr *hdr,
struct rdt_resource *r,
int domid)
{
code here
}
A subset of this repeated pattern (just the kernfs_create_dir(),
rdtgroup_kn_set_ugid()) happens on every(?) mkdir. Perhaps a better helper (for
cleanup patch unrelated to this series) would build the rdtgroup_kn_set_ugid()
into a new rdtgroup_add_dir() helper?
-Tony
Powered by blists - more mailing lists