* [PATCH] eventfs: Simplify code using guard()s
@ 2025-06-04 19:16 Steven Rostedt
2025-06-05 1:04 ` Masami Hiramatsu
2025-06-05 8:09 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: Steven Rostedt @ 2025-06-04 19:16 UTC (permalink / raw)
To: LKML, Linux Trace Kernel; +Cc: Masami Hiramatsu, Mathieu Desnoyers
From: Steven Rostedt <rostedt@goodmis.org>
Use guard(mutex), scoped_guard(mutex) and guard(src) to simplify the code
and remove a lot of the jumps to "out:" labels.
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
fs/tracefs/event_inode.c | 96 +++++++++++++++-------------------------
1 file changed, 36 insertions(+), 60 deletions(-)
diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
index 8705c77a9e75..117110fbabbf 100644
--- a/fs/tracefs/event_inode.c
+++ b/fs/tracefs/event_inode.c
@@ -180,29 +180,25 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,
const char *name;
int ret;
- mutex_lock(&eventfs_mutex);
+ guard(mutex)(&eventfs_mutex);
ei = dentry->d_fsdata;
- if (ei->is_freed) {
- /* Do not allow changes if the event is about to be removed. */
- mutex_unlock(&eventfs_mutex);
+ /* Do not allow changes if the event is about to be removed. */
+ if (ei->is_freed)
return -ENODEV;
- }
/* Preallocate the children mode array if necessary */
if (!(dentry->d_inode->i_mode & S_IFDIR)) {
if (!ei->entry_attrs) {
ei->entry_attrs = kcalloc(ei->nr_entries, sizeof(*ei->entry_attrs),
GFP_NOFS);
- if (!ei->entry_attrs) {
- ret = -ENOMEM;
- goto out;
- }
+ if (!ei->entry_attrs)
+ return -ENOMEM;
}
}
ret = simple_setattr(idmap, dentry, iattr);
if (ret < 0)
- goto out;
+ return ret;
/*
* If this is a dir, then update the ei cache, only the file
@@ -225,8 +221,6 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,
}
}
}
- out:
- mutex_unlock(&eventfs_mutex);
return ret;
}
@@ -528,26 +522,24 @@ static struct dentry *eventfs_root_lookup(struct inode *dir,
struct tracefs_inode *ti;
struct eventfs_inode *ei;
const char *name = dentry->d_name.name;
- struct dentry *result = NULL;
ti = get_tracefs(dir);
if (WARN_ON_ONCE(!(ti->flags & TRACEFS_EVENT_INODE)))
return ERR_PTR(-EIO);
- mutex_lock(&eventfs_mutex);
+ guard(mutex)(&eventfs_mutex);
ei = ti->private;
if (!ei || ei->is_freed)
- goto out;
+ return NULL;
list_for_each_entry(ei_child, &ei->children, list) {
if (strcmp(ei_child->name, name) != 0)
continue;
/* A child is freed and removed from the list at the same time */
if (WARN_ON_ONCE(ei_child->is_freed))
- goto out;
- result = lookup_dir_entry(dentry, ei, ei_child);
- goto out;
+ return NULL;
+ return lookup_dir_entry(dentry, ei, ei_child);
}
for (int i = 0; i < ei->nr_entries; i++) {
@@ -561,14 +553,12 @@ static struct dentry *eventfs_root_lookup(struct inode *dir,
data = ei->data;
if (entry->callback(name, &mode, &data, &fops) <= 0)
- goto out;
+ return NULL;
+
+ return lookup_file_dentry(dentry, ei, i, mode, data, fops);
- result = lookup_file_dentry(dentry, ei, i, mode, data, fops);
- goto out;
}
- out:
- mutex_unlock(&eventfs_mutex);
- return result;
+ return NULL;
}
/*
@@ -584,7 +574,6 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
struct eventfs_inode *ei;
const char *name;
umode_t mode;
- int idx;
int ret = -EINVAL;
int ino;
int i, r, c;
@@ -598,16 +587,13 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
c = ctx->pos - 2;
- idx = srcu_read_lock(&eventfs_srcu);
+ guard(srcu)(&eventfs_srcu);
- mutex_lock(&eventfs_mutex);
- ei = READ_ONCE(ti->private);
- if (ei && ei->is_freed)
- ei = NULL;
- mutex_unlock(&eventfs_mutex);
-
- if (!ei)
- goto out;
+ scoped_guard(mutex, &eventfs_mutex) {
+ ei = READ_ONCE(ti->private);
+ if (!ei || ei->is_freed)
+ return -EINVAL;
+ }
/*
* Need to create the dentries and inodes to have a consistent
@@ -622,21 +608,19 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
entry = &ei->entries[i];
name = entry->name;
- mutex_lock(&eventfs_mutex);
/* If ei->is_freed then just bail here, nothing more to do */
- if (ei->is_freed) {
- mutex_unlock(&eventfs_mutex);
- goto out;
+ scoped_guard(mutex, &eventfs_mutex) {
+ if (ei->is_freed)
+ return -EINVAL;
+ r = entry->callback(name, &mode, &cdata, &fops);
}
- r = entry->callback(name, &mode, &cdata, &fops);
- mutex_unlock(&eventfs_mutex);
if (r <= 0)
continue;
ino = EVENTFS_FILE_INODE_INO;
if (!dir_emit(ctx, name, strlen(name), ino, DT_REG))
- goto out;
+ return -EINVAL;
}
/* Subtract the skipped entries above */
@@ -659,19 +643,13 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
ino = eventfs_dir_ino(ei_child);
- if (!dir_emit(ctx, name, strlen(name), ino, DT_DIR))
- goto out_dec;
+ if (!dir_emit(ctx, name, strlen(name), ino, DT_DIR)) {
+ /* Incremented ctx->pos without adding something, reset it */
+ ctx->pos--;
+ return -EINVAL;
+ }
}
- ret = 1;
- out:
- srcu_read_unlock(&eventfs_srcu, idx);
-
- return ret;
-
- out_dec:
- /* Incremented ctx->pos without adding something, reset it */
- ctx->pos--;
- goto out;
+ return 1;
}
/**
@@ -728,11 +706,10 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode
INIT_LIST_HEAD(&ei->children);
INIT_LIST_HEAD(&ei->list);
- mutex_lock(&eventfs_mutex);
- if (!parent->is_freed)
- list_add_tail(&ei->list, &parent->children);
- mutex_unlock(&eventfs_mutex);
-
+ scoped_guard(mutex, &eventfs_mutex) {
+ if (!parent->is_freed)
+ list_add_tail(&ei->list, &parent->children);
+ }
/* Was the parent freed? */
if (list_empty(&ei->list)) {
cleanup_ei(ei);
@@ -877,9 +854,8 @@ void eventfs_remove_dir(struct eventfs_inode *ei)
if (!ei)
return;
- mutex_lock(&eventfs_mutex);
+ guard(mutex)(&eventfs_mutex);
eventfs_remove_rec(ei, 0);
- mutex_unlock(&eventfs_mutex);
}
/**
--
2.47.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] eventfs: Simplify code using guard()s
2025-06-04 19:16 [PATCH] eventfs: Simplify code using guard()s Steven Rostedt
@ 2025-06-05 1:04 ` Masami Hiramatsu
2025-06-05 8:09 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2025-06-05 1:04 UTC (permalink / raw)
To: Steven Rostedt
Cc: LKML, Linux Trace Kernel, Masami Hiramatsu, Mathieu Desnoyers
On Wed, 4 Jun 2025 15:16:25 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
>
> Use guard(mutex), scoped_guard(mutex) and guard(src) to simplify the code
> and remove a lot of the jumps to "out:" labels.
>
Looks good to me.
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Thanks!
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---
> fs/tracefs/event_inode.c | 96 +++++++++++++++-------------------------
> 1 file changed, 36 insertions(+), 60 deletions(-)
>
> diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
> index 8705c77a9e75..117110fbabbf 100644
> --- a/fs/tracefs/event_inode.c
> +++ b/fs/tracefs/event_inode.c
> @@ -180,29 +180,25 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,
> const char *name;
> int ret;
>
> - mutex_lock(&eventfs_mutex);
> + guard(mutex)(&eventfs_mutex);
> ei = dentry->d_fsdata;
> - if (ei->is_freed) {
> - /* Do not allow changes if the event is about to be removed. */
> - mutex_unlock(&eventfs_mutex);
> + /* Do not allow changes if the event is about to be removed. */
> + if (ei->is_freed)
> return -ENODEV;
> - }
>
> /* Preallocate the children mode array if necessary */
> if (!(dentry->d_inode->i_mode & S_IFDIR)) {
> if (!ei->entry_attrs) {
> ei->entry_attrs = kcalloc(ei->nr_entries, sizeof(*ei->entry_attrs),
> GFP_NOFS);
> - if (!ei->entry_attrs) {
> - ret = -ENOMEM;
> - goto out;
> - }
> + if (!ei->entry_attrs)
> + return -ENOMEM;
> }
> }
>
> ret = simple_setattr(idmap, dentry, iattr);
> if (ret < 0)
> - goto out;
> + return ret;
>
> /*
> * If this is a dir, then update the ei cache, only the file
> @@ -225,8 +221,6 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,
> }
> }
> }
> - out:
> - mutex_unlock(&eventfs_mutex);
> return ret;
> }
>
> @@ -528,26 +522,24 @@ static struct dentry *eventfs_root_lookup(struct inode *dir,
> struct tracefs_inode *ti;
> struct eventfs_inode *ei;
> const char *name = dentry->d_name.name;
> - struct dentry *result = NULL;
>
> ti = get_tracefs(dir);
> if (WARN_ON_ONCE(!(ti->flags & TRACEFS_EVENT_INODE)))
> return ERR_PTR(-EIO);
>
> - mutex_lock(&eventfs_mutex);
> + guard(mutex)(&eventfs_mutex);
>
> ei = ti->private;
> if (!ei || ei->is_freed)
> - goto out;
> + return NULL;
>
> list_for_each_entry(ei_child, &ei->children, list) {
> if (strcmp(ei_child->name, name) != 0)
> continue;
> /* A child is freed and removed from the list at the same time */
> if (WARN_ON_ONCE(ei_child->is_freed))
> - goto out;
> - result = lookup_dir_entry(dentry, ei, ei_child);
> - goto out;
> + return NULL;
> + return lookup_dir_entry(dentry, ei, ei_child);
> }
>
> for (int i = 0; i < ei->nr_entries; i++) {
> @@ -561,14 +553,12 @@ static struct dentry *eventfs_root_lookup(struct inode *dir,
>
> data = ei->data;
> if (entry->callback(name, &mode, &data, &fops) <= 0)
> - goto out;
> + return NULL;
> +
> + return lookup_file_dentry(dentry, ei, i, mode, data, fops);
>
> - result = lookup_file_dentry(dentry, ei, i, mode, data, fops);
> - goto out;
> }
> - out:
> - mutex_unlock(&eventfs_mutex);
> - return result;
> + return NULL;
> }
>
> /*
> @@ -584,7 +574,6 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
> struct eventfs_inode *ei;
> const char *name;
> umode_t mode;
> - int idx;
> int ret = -EINVAL;
> int ino;
> int i, r, c;
> @@ -598,16 +587,13 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
>
> c = ctx->pos - 2;
>
> - idx = srcu_read_lock(&eventfs_srcu);
> + guard(srcu)(&eventfs_srcu);
>
> - mutex_lock(&eventfs_mutex);
> - ei = READ_ONCE(ti->private);
> - if (ei && ei->is_freed)
> - ei = NULL;
> - mutex_unlock(&eventfs_mutex);
> -
> - if (!ei)
> - goto out;
> + scoped_guard(mutex, &eventfs_mutex) {
> + ei = READ_ONCE(ti->private);
> + if (!ei || ei->is_freed)
> + return -EINVAL;
> + }
>
> /*
> * Need to create the dentries and inodes to have a consistent
> @@ -622,21 +608,19 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
> entry = &ei->entries[i];
> name = entry->name;
>
> - mutex_lock(&eventfs_mutex);
> /* If ei->is_freed then just bail here, nothing more to do */
> - if (ei->is_freed) {
> - mutex_unlock(&eventfs_mutex);
> - goto out;
> + scoped_guard(mutex, &eventfs_mutex) {
> + if (ei->is_freed)
> + return -EINVAL;
> + r = entry->callback(name, &mode, &cdata, &fops);
> }
> - r = entry->callback(name, &mode, &cdata, &fops);
> - mutex_unlock(&eventfs_mutex);
> if (r <= 0)
> continue;
>
> ino = EVENTFS_FILE_INODE_INO;
>
> if (!dir_emit(ctx, name, strlen(name), ino, DT_REG))
> - goto out;
> + return -EINVAL;
> }
>
> /* Subtract the skipped entries above */
> @@ -659,19 +643,13 @@ static int eventfs_iterate(struct file *file, struct dir_context *ctx)
>
> ino = eventfs_dir_ino(ei_child);
>
> - if (!dir_emit(ctx, name, strlen(name), ino, DT_DIR))
> - goto out_dec;
> + if (!dir_emit(ctx, name, strlen(name), ino, DT_DIR)) {
> + /* Incremented ctx->pos without adding something, reset it */
> + ctx->pos--;
> + return -EINVAL;
> + }
> }
> - ret = 1;
> - out:
> - srcu_read_unlock(&eventfs_srcu, idx);
> -
> - return ret;
> -
> - out_dec:
> - /* Incremented ctx->pos without adding something, reset it */
> - ctx->pos--;
> - goto out;
> + return 1;
> }
>
> /**
> @@ -728,11 +706,10 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode
> INIT_LIST_HEAD(&ei->children);
> INIT_LIST_HEAD(&ei->list);
>
> - mutex_lock(&eventfs_mutex);
> - if (!parent->is_freed)
> - list_add_tail(&ei->list, &parent->children);
> - mutex_unlock(&eventfs_mutex);
> -
> + scoped_guard(mutex, &eventfs_mutex) {
> + if (!parent->is_freed)
> + list_add_tail(&ei->list, &parent->children);
> + }
> /* Was the parent freed? */
> if (list_empty(&ei->list)) {
> cleanup_ei(ei);
> @@ -877,9 +854,8 @@ void eventfs_remove_dir(struct eventfs_inode *ei)
> if (!ei)
> return;
>
> - mutex_lock(&eventfs_mutex);
> + guard(mutex)(&eventfs_mutex);
> eventfs_remove_rec(ei, 0);
> - mutex_unlock(&eventfs_mutex);
> }
>
> /**
> --
> 2.47.2
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] eventfs: Simplify code using guard()s
2025-06-04 19:16 [PATCH] eventfs: Simplify code using guard()s Steven Rostedt
2025-06-05 1:04 ` Masami Hiramatsu
@ 2025-06-05 8:09 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2025-06-05 8:09 UTC (permalink / raw)
To: Steven Rostedt, LKML, Linux Trace Kernel
Cc: oe-kbuild-all, Masami Hiramatsu, Mathieu Desnoyers
Hi Steven,
kernel test robot noticed the following build warnings:
[auto build test WARNING on trace/for-next]
[also build test WARNING on linus/master v6.15 next-20250605]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Steven-Rostedt/eventfs-Simplify-code-using-guard-s/20250605-035636
base: https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link: https://lore.kernel.org/r/20250604151625.250d13e1%40gandalf.local.home
patch subject: [PATCH] eventfs: Simplify code using guard()s
config: csky-randconfig-001-20250605 (https://download.01.org/0day-ci/archive/20250605/202506051521.4YOBbYuj-lkp@intel.com/config)
compiler: csky-linux-gcc (GCC) 10.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250605/202506051521.4YOBbYuj-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202506051521.4YOBbYuj-lkp@intel.com/
All warnings (new ones prefixed by >>):
fs/tracefs/event_inode.c: In function 'eventfs_iterate':
>> fs/tracefs/event_inode.c:577:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
577 | int ret = -EINVAL;
| ^~~
vim +/ret +577 fs/tracefs/event_inode.c
63940449555e79 Ajay Kaher 2023-07-28 563
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 564) /*
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 565) * Walk the children of a eventfs_inode to fill in getdents().
63940449555e79 Ajay Kaher 2023-07-28 566 */
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 567) static int eventfs_iterate(struct file *file, struct dir_context *ctx)
63940449555e79 Ajay Kaher 2023-07-28 568 {
5790b1fb3d672d Steven Rostedt (Google 2023-10-04 569) const struct file_operations *fops;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 570) struct inode *f_inode = file_inode(file);
5790b1fb3d672d Steven Rostedt (Google 2023-10-04 571) const struct eventfs_entry *entry;
5790b1fb3d672d Steven Rostedt (Google 2023-10-04 572) struct eventfs_inode *ei_child;
63940449555e79 Ajay Kaher 2023-07-28 573 struct tracefs_inode *ti;
63940449555e79 Ajay Kaher 2023-07-28 574 struct eventfs_inode *ei;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 575) const char *name;
5790b1fb3d672d Steven Rostedt (Google 2023-10-04 576) umode_t mode;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 @577) int ret = -EINVAL;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 578) int ino;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 579) int i, r, c;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 580)
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 581) if (!dir_emit_dots(file, ctx))
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 582) return 0;
63940449555e79 Ajay Kaher 2023-07-28 583
63940449555e79 Ajay Kaher 2023-07-28 584 ti = get_tracefs(f_inode);
63940449555e79 Ajay Kaher 2023-07-28 585 if (!(ti->flags & TRACEFS_EVENT_INODE))
63940449555e79 Ajay Kaher 2023-07-28 586 return -EINVAL;
63940449555e79 Ajay Kaher 2023-07-28 587
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 588) c = ctx->pos - 2;
ef36b4f92868d6 Steven Rostedt (Google 2023-09-22 589)
97aa2be4ff039f Steven Rostedt 2025-06-04 590 guard(srcu)(&eventfs_srcu);
5790b1fb3d672d Steven Rostedt (Google 2023-10-04 591)
97aa2be4ff039f Steven Rostedt 2025-06-04 592 scoped_guard(mutex, &eventfs_mutex) {
5790b1fb3d672d Steven Rostedt (Google 2023-10-04 593) ei = READ_ONCE(ti->private);
97aa2be4ff039f Steven Rostedt 2025-06-04 594 if (!ei || ei->is_freed)
97aa2be4ff039f Steven Rostedt 2025-06-04 595 return -EINVAL;
97aa2be4ff039f Steven Rostedt 2025-06-04 596 }
5790b1fb3d672d Steven Rostedt (Google 2023-10-04 597)
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 598) /*
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 599) * Need to create the dentries and inodes to have a consistent
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 600) * inode number.
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 601) */
1de94b52d5e8d8 Steven Rostedt (Google 2024-01-04 602) ret = 0;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 603)
1de94b52d5e8d8 Steven Rostedt (Google 2024-01-04 604) /* Start at 'c' to jump over already read entries */
1de94b52d5e8d8 Steven Rostedt (Google 2024-01-04 605) for (i = c; i < ei->nr_entries; i++, ctx->pos++) {
1de94b52d5e8d8 Steven Rostedt (Google 2024-01-04 606) void *cdata = ei->data;
1e4624eb5a0eca Steven Rostedt (Google 2024-01-04 607)
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 608) entry = &ei->entries[i];
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 609) name = entry->name;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 610)
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 611) /* If ei->is_freed then just bail here, nothing more to do */
97aa2be4ff039f Steven Rostedt 2025-06-04 612 scoped_guard(mutex, &eventfs_mutex) {
97aa2be4ff039f Steven Rostedt 2025-06-04 613 if (ei->is_freed)
97aa2be4ff039f Steven Rostedt 2025-06-04 614 return -EINVAL;
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 615) r = entry->callback(name, &mode, &cdata, &fops);
97aa2be4ff039f Steven Rostedt 2025-06-04 616 }
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 617) if (r <= 0)
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 618) continue;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 619)
852e46e239ee6d Steven Rostedt (Google 2024-01-16 620) ino = EVENTFS_FILE_INODE_INO;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 621)
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 622) if (!dir_emit(ctx, name, strlen(name), ino, DT_REG))
97aa2be4ff039f Steven Rostedt 2025-06-04 623 return -EINVAL;
5790b1fb3d672d Steven Rostedt (Google 2023-10-04 624) }
ef36b4f92868d6 Steven Rostedt (Google 2023-09-22 625)
1de94b52d5e8d8 Steven Rostedt (Google 2024-01-04 626) /* Subtract the skipped entries above */
1de94b52d5e8d8 Steven Rostedt (Google 2024-01-04 627) c -= min((unsigned int)c, (unsigned int)ei->nr_entries);
1de94b52d5e8d8 Steven Rostedt (Google 2024-01-04 628)
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 629) list_for_each_entry_srcu(ei_child, &ei->children, list,
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 630) srcu_read_lock_held(&eventfs_srcu)) {
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 631)
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 632) if (c > 0) {
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 633) c--;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 634) continue;
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 635) }
493ec81a8fb8e4 Steven Rostedt (Google 2024-01-03 636)
1e4624eb5a0eca Steven Rostedt (Google 2024-01-04 637) ctx->pos++;
1e4624eb5a0eca Steven Rostedt (Google 2024-01-04 638)
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 639) if (ei_child->is_freed)
5790b1fb3d672d Steven Rostedt (Google 2023-10-04 640) continue;
ef36b4f92868d6 Steven Rostedt (Google 2023-09-22 641)
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 642) name = ei_child->name;
704f960dbee2f1 Steven Rostedt (Google 2024-01-04 643)
834bf76add3e61 Steven Rostedt (Google 2024-01-22 644) ino = eventfs_dir_ino(ei_child);
ef36b4f92868d6 Steven Rostedt (Google 2023-09-22 645)
97aa2be4ff039f Steven Rostedt 2025-06-04 646 if (!dir_emit(ctx, name, strlen(name), ino, DT_DIR)) {
1e4624eb5a0eca Steven Rostedt (Google 2024-01-04 647) /* Incremented ctx->pos without adding something, reset it */
1e4624eb5a0eca Steven Rostedt (Google 2024-01-04 648) ctx->pos--;
97aa2be4ff039f Steven Rostedt 2025-06-04 649 return -EINVAL;
97aa2be4ff039f Steven Rostedt 2025-06-04 650 }
97aa2be4ff039f Steven Rostedt 2025-06-04 651 }
97aa2be4ff039f Steven Rostedt 2025-06-04 652 return 1;
63940449555e79 Ajay Kaher 2023-07-28 653 }
63940449555e79 Ajay Kaher 2023-07-28 654
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-05 8:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-04 19:16 [PATCH] eventfs: Simplify code using guard()s Steven Rostedt
2025-06-05 1:04 ` Masami Hiramatsu
2025-06-05 8:09 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).