Whamcloud - gitweb
LU-10918 llite: Rule based auto PCC caching when create files
[fs/lustre-release.git] / lustre / llite / pcc.h
index 7e4996e..0840a0b 100644 (file)
@@ -42,13 +42,64 @@ extern struct kmem_cache *pcc_inode_slab;
 
 #define LPROCFS_WR_PCC_MAX_CMD 4096
 
 
 #define LPROCFS_WR_PCC_MAX_CMD 4096
 
+/* User/Group/Project ID */
+struct pcc_match_id {
+       __u32                   pmi_id;
+       struct list_head        pmi_linkage;
+};
+
+/* wildcard file name */
+struct pcc_match_fname {
+       char                    *pmf_name;
+       struct list_head         pmf_linkage;
+};
+
+enum pcc_field {
+       PCC_FIELD_UID,
+       PCC_FIELD_GID,
+       PCC_FIELD_PROJID,
+       PCC_FIELD_FNAME,
+       PCC_FIELD_MAX
+};
+
+struct pcc_expression {
+       enum pcc_field          pe_field;
+       struct list_head        pe_cond;
+       struct list_head        pe_linkage;
+};
+
+struct pcc_conjunction {
+       /* link to disjunction */
+       struct list_head        pc_linkage;
+       /* list of logical conjunction */
+       struct list_head        pc_expressions;
+};
+
+/**
+ * Match rule for auto PCC-cached files.
+ */
+struct pcc_match_rule {
+       char                    *pmr_conds_str;
+       struct list_head         pmr_conds;
+};
+
+struct pcc_matcher {
+       __u32            pm_uid;
+       __u32            pm_gid;
+       __u32            pm_projid;
+       struct qstr     *pm_name;
+};
+
 struct pcc_dataset {
 struct pcc_dataset {
-       __u32                   pccd_id;         /* Archive ID */
-       __u32                   pccd_projid;     /* Project ID */
+       __u32                   pccd_rwid;       /* Archive ID */
+       __u32                   pccd_roid;       /* Readonly ID */
+       struct pcc_match_rule   pccd_rule;       /* Match rule */
+       __u32                   pccd_rwonly:1, /* Only use as RW-PCC */
+                               pccd_roonly:1; /* Only use as RO-PCC */
        char                    pccd_pathname[PATH_MAX]; /* full path */
        struct path             pccd_path;       /* Root path */
        struct list_head        pccd_linkage;  /* Linked to pccs_datasets */
        char                    pccd_pathname[PATH_MAX]; /* full path */
        struct path             pccd_path;       /* Root path */
        struct list_head        pccd_linkage;  /* Linked to pccs_datasets */
-       atomic_t                pccd_refcount; /* reference count */
+       atomic_t                pccd_refcount; /* Reference count */
 };
 
 struct pcc_super {
 };
 
 struct pcc_super {
@@ -102,8 +153,10 @@ struct pcc_cmd {
        char                                    *pccc_pathname;
        union {
                struct pcc_cmd_add {
        char                                    *pccc_pathname;
        union {
                struct pcc_cmd_add {
-                       __u32                    pccc_id;
-                       __u32                    pccc_projid;
+                       __u32                    pccc_rwid;
+                       __u32                    pccc_roid;
+                       struct list_head         pccc_conds;
+                       char                    *pccc_conds_str;
                } pccc_add;
                struct pcc_cmd_del {
                        __u32                    pccc_pad;
                } pccc_add;
                struct pcc_cmd_del {
                        __u32                    pccc_pad;
@@ -148,8 +201,8 @@ int pcc_inode_create(struct super_block *sb, struct pcc_dataset *dataset,
                     struct lu_fid *fid, struct dentry **pcc_dentry);
 int pcc_inode_create_fini(struct pcc_dataset *dataset, struct inode *inode,
                           struct dentry *pcc_dentry);
                     struct lu_fid *fid, struct dentry **pcc_dentry);
 int pcc_inode_create_fini(struct pcc_dataset *dataset, struct inode *inode,
                           struct dentry *pcc_dentry);
-struct pcc_dataset *pcc_dataset_get(struct pcc_super *super, __u32 projid,
-                                   __u32 archive_id);
+struct pcc_dataset *pcc_dataset_match_get(struct pcc_super *super,
+                                         struct pcc_matcher *matcher);
 void pcc_dataset_put(struct pcc_dataset *dataset);
 void pcc_inode_free(struct inode *inode);
 void pcc_layout_invalidate(struct inode *inode);
 void pcc_dataset_put(struct pcc_dataset *dataset);
 void pcc_inode_free(struct inode *inode);
 void pcc_layout_invalidate(struct inode *inode);