]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/nfs/pnfs.h
pnfs: change how lsegs are removed from layout list
[mirror_ubuntu-bionic-kernel.git] / fs / nfs / pnfs.h
index e12367d504894ae15e9066d66446487fd69fa81e..787253e6fca351365c7e75aa825e2105c2277e2b 100644 (file)
 #ifndef FS_NFS_PNFS_H
 #define FS_NFS_PNFS_H
 
+enum {
+       NFS_LSEG_VALID = 0,     /* cleared when lseg is recalled/returned */
+};
+
 struct pnfs_layout_segment {
-       struct list_head fi_list;
-       struct pnfs_layout_range range;
-       struct kref kref;
-       struct pnfs_layout_hdr *layout;
+       struct list_head pls_list;
+       struct pnfs_layout_range pls_range;
+       atomic_t pls_refcount;
+       unsigned long pls_flags;
+       struct pnfs_layout_hdr *pls_layout;
 };
 
 #ifdef CONFIG_NFS_V4_1
@@ -44,7 +49,7 @@ struct pnfs_layout_segment {
 enum {
        NFS_LAYOUT_RO_FAILED = 0,       /* get ro layout failed stop trying */
        NFS_LAYOUT_RW_FAILED,           /* get rw layout failed stop trying */
-       NFS_LAYOUT_STATEID_SET,         /* have a valid layout stateid */
+       NFS_LAYOUT_DESTROYED,           /* no new use of layout allowed */
 };
 
 /* Per-layout driver specific registration structure */
@@ -60,13 +65,12 @@ struct pnfs_layoutdriver_type {
 };
 
 struct pnfs_layout_hdr {
-       unsigned long           refcount;
-       struct list_head        layouts;   /* other client layouts */
-       struct list_head        segs;      /* layout segments list */
-       seqlock_t               seqlock;   /* Protects the stateid */
-       nfs4_stateid            stateid;
-       unsigned long           state;
-       struct inode            *inode;
+       unsigned long           plh_refcount;
+       struct list_head        plh_layouts;   /* other client layouts */
+       struct list_head        plh_segs;      /* layout segments list */
+       nfs4_stateid            plh_stateid;
+       unsigned long           plh_flags;
+       struct inode            *plh_inode;
 };
 
 struct pnfs_device {
@@ -143,8 +147,9 @@ int pnfs_layout_process(struct nfs4_layoutget *lgp);
 void pnfs_destroy_layout(struct nfs_inode *);
 void pnfs_destroy_all_layouts(struct nfs_client *);
 void put_layout_hdr(struct inode *inode);
-void pnfs_get_layout_stateid(nfs4_stateid *dst, struct pnfs_layout_hdr *lo,
-                            struct nfs4_state *open_state);
+int pnfs_choose_layoutget_stateid(nfs4_stateid *dst,
+                                 struct pnfs_layout_hdr *lo,
+                                 struct nfs4_state *open_state);
 
 
 static inline int lo_fail_bit(u32 iomode)