fs/ceph/dir: __{dir,dentry}_lease_check() returns an enum
PATCH 1/1 fs/ceph/dir: __{dir,dentry}_lease_check() returns an enum
The declaration of these return valued (KEEP, DELETE, TOUCH, STOP) and their use in __dentry_leases_walk() suggests that these are bit flags, but there is only ever one bit set. Converting these to a non-anonymous enum expresses the intent more clearly.
--- fs/ceph/dir.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-)
fs/ceph/dir.c +18 -15
@@ -1626,11 +1626,14 @@ static void __dentry_lease_unlist(struct ceph_dentry_info *di)spin_unlock (&mdsc->dentry_list_lock); } -enum { -KEEP =0 , -DELETE =1 , -TOUCH =2 , -STOP =4 , +/** +* Result of __dir_lease_check() and __dentry_lease_check(). +*/ +enum lease_check_result { +KEEP , +DELETE , +TOUCH , +STOP , };struct ceph_lease_walk_control {
@@ -1640,8 +1643,8 @@ struct ceph_lease_walk_control {unsigned long dir_lease_ttl; }; -static int __dir_lease_check (const struct dentry *,struct ceph_lease_walk_control *); -static int __dentry_lease_check (const struct dentry *); +static enum lease_check_result __dir_lease_check (const struct dentry *,struct ceph_lease_walk_control *); +static enum lease_check_result __dentry_lease_check (const struct dentry *); static unsigned long __dentry_leases_walk(struct ceph_mds_client *mdsc,
@@ -1652,11 +1655,12 @@ __dentry_leases_walk(struct ceph_mds_client *mdsc,struct list_head * list;LIST_HEAD (dispose);unsigned long freed =0 ; -int ret =0 ; list = lwc->dir_lease ? &mdsc->dentry_dir_leases : &mdsc->dentry_leases;spin_lock (&mdsc->dentry_list_lock);list_for_each_entry_safe (di, tmp, list, lease_list) { +enum lease_check_result ret =KEEP ; +if (!lwc->nr_to_scan)break ; --lwc->nr_to_scan;
@@ -1677,13 +1681,12 @@ __dentry_leases_walk(struct ceph_mds_client *mdsc, ret =__dir_lease_check (dentry, lwc); else ret =__dentry_lease_check (dentry); -if (ret &TOUCH ) { +if (ret ==TOUCH ) {/* move it into tail of dir lease list */ __dentry_dir_lease_touch (mdsc, di);if (!last) last = dentry; - } -if (ret &DELETE ) { + }else if (ret ==DELETE ) {/* stale lease */ di->flags &= ~CEPH_DENTRY_REFERENCED ;if (dentry->d_lockref.count >0 ) {
@@ -1700,7 +1703,7 @@ __dentry_leases_walk(struct ceph_mds_client *mdsc, } next:spin_unlock (&dentry->d_lock); -if (ret &STOP ) +if (ret ==STOP )break ; }spin_unlock (&mdsc->dentry_list_lock);
@@ -1733,7 +1736,7 @@ __dentry_leases_walk(struct ceph_mds_client *mdsc,return freed; } -static int __dentry_lease_check (const struct dentry *dentry) +static enum lease_check_result __dentry_lease_check (const struct dentry *dentry) {struct ceph_dentry_info *di =ceph_dentry (dentry);int ret;
@@ -1748,8 +1751,8 @@ static int __dentry_lease_check(const struct dentry *dentry)return DELETE ; } -static int __dir_lease_check (const struct dentry *dentry, -struct ceph_lease_walk_control *lwc) +static enum lease_check_result __dir_lease_check (const struct dentry *dentry, +struct ceph_lease_walk_control *lwc) {struct ceph_dentry_info *di =ceph_dentry (dentry);
Signature · 1 line
2.47.3
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Max,
kernel test robot noticed the following build warnings:
[auto build test WARNING on ceph-client/testing]
[also build test WARNING on ceph-client/for-linus linus/master v7.2-rc6 next-20260807] [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/Max-Kellermann/fs-ceph-dir-__-dir-dentry-_lease_check-returns-an-enum/20260811-130303 base: https://github.com/ceph/ceph-client.git testing patch link: https://lore.kernel.org/r/20260709104121.884183-1-max.kellermann%40ionos.com patch subject: [PATCH] fs/ceph/dir: __{dir,dentry}_lease_check() returns an enum config: alpha-allmodconfig (https://download.01.org/0day-ci/archive/20260811/[email protected]/config) compiler: alpha-linux-gcc (GCC) 16.1.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260811/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> Warning: fs/ceph/dir.c:1634 This comment starts with '/**', but isn't a kernel-doc comment. Refer to Documentation/doc-guide/kernel-doc.rst
* Result of __dir_lease_check() and __dentry_lease_check().
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Max,
Thanks for the patch.
Signature · 1 line
Alex Markuze