[RFC PATCH v6 0/4] fuse: work queues to invalided dentries

Luis Henriques posted 4 patches 4 months, 3 weeks ago
fs/dcache.c            |  18 ++--
fs/fuse/dev.c          |   7 +-
fs/fuse/dir.c          | 237 +++++++++++++++++++++++++++++++++++++----
fs/fuse/fuse_i.h       |  14 +++
fs/fuse/inode.c        |  44 ++++----
include/linux/dcache.h |   2 +
6 files changed, 273 insertions(+), 49 deletions(-)
[RFC PATCH v6 0/4] fuse: work queues to invalided dentries
Posted by Luis Henriques 4 months, 3 weeks ago
Hi Miklos,

Here's a new version of the patchset to invalidate expired dentries.  Most
of the changes (and there are a lot of them!) result from the v5 review.
See below for details.

Changes since v5:

- Changes to dcache: export shrink_dentry_list() and add new helper
  d_dispose_if_unused()
- Reduced hash lock array size
- Set 'inval_wq' max value to USHRT_MAX to prevent a potential overflow in
  secs_to_jiffies()
- Updated 'inval_wq' parameter description and comment
- Removed useless check in fuse_dentry_tree_del_node()
- Make fuse_dentry_tree_work() use dcache helpers d_dispose_if_unused() and
  shrink_dentry_list()
- Fix usage of need_resched() (replaced with cond_resched())
- fuse_dentry_tree_cleanup() now simply does a WARN_ON() if there are
  non-empty trees
- Removed TODO comment in fuse_conn_destroy() -- no need to prune trees
- Have fuse_epoch_work() use of shrink_dcache_sb() instead of going through
  all the trees
- Refactor fuse_conn_put() in a separate patch
- Fix bug in fuse_dentry_tree_add_node() for cases where dentries have the
  same timeout
- Reword some of the commits text

Changes since v4:
 
- Dropped extra check in fuse_dentry_tree_add_node() (Chunsheng)
- Make the dentries trees global instead of per fuse_conn (Miklos)
- Protect trees with hashed locking instead of a single lock (Miklos)
- Added new work queue (2nd patch) specifically to handle epoch (Miklos)
 
Changes since v3:
 
- Use of need_resched() instead of limiting the work queue to run for 5
  seconds
- Restore usage of union with rcu_head, in struct fuse_dentry
- Minor changes in comments (e.g. s/workqueue/work queue/)
 
Changes since v2:
 
- Major rework, the dentries tree nodes are now in fuse_dentry and they are
  tied to the actual dentry lifetime
- Mount option is now a module parameter
- workqueue now runs for at most 5 seconds before rescheduling

Luis Henriques (4):
  dcache: export shrink_dentry_list() and new helper
    d_dispose_if_unused()
  fuse: new work queue to periodically invalidate expired dentries
  fuse: new work queue to invalidate dentries from old epochs
  fuse: refactor fuse_conn_put() to remove negative logic.

 fs/dcache.c            |  18 ++--
 fs/fuse/dev.c          |   7 +-
 fs/fuse/dir.c          | 237 +++++++++++++++++++++++++++++++++++++----
 fs/fuse/fuse_i.h       |  14 +++
 fs/fuse/inode.c        |  44 ++++----
 include/linux/dcache.h |   2 +
 6 files changed, 273 insertions(+), 49 deletions(-)
Re: [RFC PATCH v6 0/4] fuse: work queues to invalided dentries
Posted by Miklos Szeredi 2 months, 3 weeks ago
On Tue, 16 Sept 2025 at 15:53, Luis Henriques <luis@igalia.com> wrote:
>
> Hi Miklos,
>
> Here's a new version of the patchset to invalidate expired dentries.  Most
> of the changes (and there are a lot of them!) result from the v5 review.
> See below for details.

Applied, thanks.

Miklos
Re: [RFC PATCH v6 0/4] fuse: work queues to invalided dentries
Posted by Luis Henriques 2 months, 3 weeks ago
On Thu, Nov 13 2025, Miklos Szeredi wrote:

> On Tue, 16 Sept 2025 at 15:53, Luis Henriques <luis@igalia.com> wrote:
>>
>> Hi Miklos,
>>
>> Here's a new version of the patchset to invalidate expired dentries.  Most
>> of the changes (and there are a lot of them!) result from the v5 review.
>> See below for details.
>
> Applied, thanks.

That's awesome, thanks a lot Miklos!

Cheers,
-- 
Luís
Re: [RFC PATCH v6 0/4] fuse: work queues to invalided dentries
Posted by Luis Henriques 3 months, 2 weeks ago
Hey Miklos,

On Tue, Sep 16 2025, Luis Henriques wrote:

> Hi Miklos,
>
> Here's a new version of the patchset to invalidate expired dentries.  Most
> of the changes (and there are a lot of them!) result from the v5 review.
> See below for details.

Just a gentle ping to make sure it doesn't fall through the cracks.

Cheers,
-- 
Luís


> Changes since v5:
>
> - Changes to dcache: export shrink_dentry_list() and add new helper
>   d_dispose_if_unused()
> - Reduced hash lock array size
> - Set 'inval_wq' max value to USHRT_MAX to prevent a potential overflow in
>   secs_to_jiffies()
> - Updated 'inval_wq' parameter description and comment
> - Removed useless check in fuse_dentry_tree_del_node()
> - Make fuse_dentry_tree_work() use dcache helpers d_dispose_if_unused() and
>   shrink_dentry_list()
> - Fix usage of need_resched() (replaced with cond_resched())
> - fuse_dentry_tree_cleanup() now simply does a WARN_ON() if there are
>   non-empty trees
> - Removed TODO comment in fuse_conn_destroy() -- no need to prune trees
> - Have fuse_epoch_work() use of shrink_dcache_sb() instead of going through
>   all the trees
> - Refactor fuse_conn_put() in a separate patch
> - Fix bug in fuse_dentry_tree_add_node() for cases where dentries have the
>   same timeout
> - Reword some of the commits text
>
> Changes since v4:
>  
> - Dropped extra check in fuse_dentry_tree_add_node() (Chunsheng)
> - Make the dentries trees global instead of per fuse_conn (Miklos)
> - Protect trees with hashed locking instead of a single lock (Miklos)
> - Added new work queue (2nd patch) specifically to handle epoch (Miklos)
>  
> Changes since v3:
>  
> - Use of need_resched() instead of limiting the work queue to run for 5
>   seconds
> - Restore usage of union with rcu_head, in struct fuse_dentry
> - Minor changes in comments (e.g. s/workqueue/work queue/)
>  
> Changes since v2:
>  
> - Major rework, the dentries tree nodes are now in fuse_dentry and they are
>   tied to the actual dentry lifetime
> - Mount option is now a module parameter
> - workqueue now runs for at most 5 seconds before rescheduling
>
> Luis Henriques (4):
>   dcache: export shrink_dentry_list() and new helper
>     d_dispose_if_unused()
>   fuse: new work queue to periodically invalidate expired dentries
>   fuse: new work queue to invalidate dentries from old epochs
>   fuse: refactor fuse_conn_put() to remove negative logic.
>
>  fs/dcache.c            |  18 ++--
>  fs/fuse/dev.c          |   7 +-
>  fs/fuse/dir.c          | 237 +++++++++++++++++++++++++++++++++++++----
>  fs/fuse/fuse_i.h       |  14 +++
>  fs/fuse/inode.c        |  44 ++++----
>  include/linux/dcache.h |   2 +
>  6 files changed, 273 insertions(+), 49 deletions(-)
>