at v6.0 64 lines 1.9 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Functions to handle the cached directory entries 4 * 5 * Copyright (c) 2022, Ronnie Sahlberg <lsahlber@redhat.com> 6 */ 7 8#ifndef _CACHED_DIR_H 9#define _CACHED_DIR_H 10 11 12struct cached_dirent { 13 struct list_head entry; 14 char *name; 15 int namelen; 16 loff_t pos; 17 18 struct cifs_fattr fattr; 19}; 20 21struct cached_dirents { 22 bool is_valid:1; 23 bool is_failed:1; 24 struct dir_context *ctx; /* 25 * Only used to make sure we only take entries 26 * from a single context. Never dereferenced. 27 */ 28 struct mutex de_mutex; 29 int pos; /* Expected ctx->pos */ 30 struct list_head entries; 31}; 32 33struct cached_fid { 34 bool is_valid:1; /* Do we have a useable root fid */ 35 bool file_all_info_is_valid:1; 36 bool has_lease:1; 37 unsigned long time; /* jiffies of when lease was taken */ 38 struct kref refcount; 39 struct cifs_fid fid; 40 struct mutex fid_mutex; 41 struct cifs_tcon *tcon; 42 struct dentry *dentry; 43 struct work_struct lease_break; 44 struct smb2_file_all_info file_all_info; 45 struct cached_dirents dirents; 46}; 47 48extern struct cached_fid *init_cached_dir(void); 49extern void free_cached_dir(struct cifs_tcon *tcon); 50extern int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon, 51 const char *path, 52 struct cifs_sb_info *cifs_sb, 53 bool lookup_only, struct cached_fid **cfid); 54extern int open_cached_dir_by_dentry(struct cifs_tcon *tcon, 55 struct dentry *dentry, 56 struct cached_fid **cfid); 57extern void close_cached_dir(struct cached_fid *cfid); 58extern void close_cached_dir_lease(struct cached_fid *cfid); 59extern void close_cached_dir_lease_locked(struct cached_fid *cfid); 60extern void close_all_cached_dirs(struct cifs_sb_info *cifs_sb); 61extern void invalidate_all_cached_dirs(struct cifs_tcon *tcon); 62extern int cached_dir_lease_break(struct cifs_tcon *tcon, __u8 lease_key[16]); 63 64#endif /* _CACHED_DIR_H */