mirror of
https://github.com/libfuse/libfuse.git
synced 2026-07-07 14:47:41 +08:00
add support for FUSE_NOTIFY_PRUNE
Add fuse_lowlevel_notify_prune() helper, which sends FUSE_NOTIFY_PRUNE notification to kernel indicating that the server side's inode caches with resources e.g. file handle could be cleaned up if the corresponding dentry/inode caches (with dangling references) at the kernel side could be pruned out. This is a best-effort operation as inodes with active references are skipped. Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
This commit is contained in:
committed by
Bernd Schubert
parent
e81cf70c07
commit
cba0be1bed
@@ -239,6 +239,7 @@
|
||||
* 7.45
|
||||
* - add FUSE_COPY_FILE_RANGE_64
|
||||
* - add struct fuse_copy_file_range_out
|
||||
* - add FUSE_NOTIFY_PRUNE
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_FUSE_H
|
||||
@@ -680,7 +681,7 @@ enum fuse_notify_code {
|
||||
FUSE_NOTIFY_DELETE = 6,
|
||||
FUSE_NOTIFY_RESEND = 7,
|
||||
FUSE_NOTIFY_INC_EPOCH = 8,
|
||||
FUSE_NOTIFY_CODE_MAX,
|
||||
FUSE_NOTIFY_PRUNE = 9,
|
||||
};
|
||||
|
||||
/* The read buffer is required to be at least 8k, but may be much larger */
|
||||
@@ -1119,6 +1120,12 @@ struct fuse_notify_retrieve_in {
|
||||
uint64_t dummy4;
|
||||
};
|
||||
|
||||
struct fuse_notify_prune_out {
|
||||
uint32_t count;
|
||||
uint32_t padding;
|
||||
uint64_t spare;
|
||||
};
|
||||
|
||||
struct fuse_backing_map {
|
||||
int32_t fd;
|
||||
uint32_t flags;
|
||||
|
||||
@@ -1954,6 +1954,26 @@ int fuse_lowlevel_notify_store(struct fuse_session *se, fuse_ino_t ino,
|
||||
int fuse_lowlevel_notify_retrieve(struct fuse_session *se, fuse_ino_t ino,
|
||||
size_t size, off_t offset, void *cookie);
|
||||
|
||||
/**
|
||||
* Notify to prune kernel's own dentry/inode caches
|
||||
*
|
||||
* Some fuse servers need to prune their caches, which can only be done if the
|
||||
* kernel's own dentry/inode caches are pruned first to avoid dangling
|
||||
* references. Once dangling dentry/inode cache gets pruned, the inode gets
|
||||
* evicted and thus FUSE_FORGET will be sent to fuse server. On receiving
|
||||
* FUSE_FORGET, fuse server can free their own inode cache with resources, e.g.
|
||||
* corresponding file handle.
|
||||
*
|
||||
* The notification takes an array of node IDs to try and get rid of. It is
|
||||
* best-effort as inodes with active references are skipped.
|
||||
*
|
||||
* @param se the session object
|
||||
* @param nodeids the array of node IDs to be pruned
|
||||
* @param count the length of the nodeids array
|
||||
* @return zero for success, -errno for failure
|
||||
*/
|
||||
int fuse_lowlevel_notify_prune(struct fuse_session *se,
|
||||
fuse_ino_t *nodeids, uint32_t count);
|
||||
|
||||
/* ----------------------------------------------------------- *
|
||||
* Utility functions *
|
||||
|
||||
Reference in New Issue
Block a user