pnfs: layoutret_on_setattr
[linux-2.6-block.git] / fs / nfs / pnfs.h
index c34f7a0e3bc2e1fdebade8ca535028ccb9b5a24b..af3967a893a1fc1b6fc95b63c53307692ee98b01 100644 (file)
@@ -65,6 +65,11 @@ enum {
        NFS_LAYOUT_DESTROYED,           /* no new use of layout allowed */
 };
 
+enum layoutdriver_policy_flags {
+       /* Should the pNFS client commit and return the layout upon a setattr */
+       PNFS_LAYOUTRET_ON_SETATTR       = 1 << 0,
+};
+
 struct nfs4_deviceid_node;
 
 /* Per-layout driver specific registration structure */
@@ -73,6 +78,7 @@ struct pnfs_layoutdriver_type {
        const u32 id;
        const char *name;
        struct module *owner;
+       unsigned flags;
 
        struct pnfs_layout_hdr * (*alloc_layout_hdr) (struct inode *inode, gfp_t gfp_flags);
        void (*free_layout_hdr) (struct pnfs_layout_hdr *);
@@ -258,6 +264,16 @@ static inline void pnfs_clear_request_commit(struct nfs_page *req)
                put_lseg(req->wb_commit_lseg);
 }
 
+/* Should the pNFS client commit and return the layout upon a setattr */
+static inline bool
+pnfs_ld_layoutret_on_setattr(struct inode *inode)
+{
+       if (!pnfs_enabled_sb(NFS_SERVER(inode)))
+               return false;
+       return NFS_SERVER(inode)->pnfs_curr_ld->flags &
+               PNFS_LAYOUTRET_ON_SETATTR;
+}
+
 static inline int pnfs_return_layout(struct inode *ino)
 {
        struct nfs_inode *nfsi = NFS_I(ino);
@@ -316,6 +332,12 @@ static inline int pnfs_return_layout(struct inode *ino)
        return 0;
 }
 
+static inline bool
+pnfs_ld_layoutret_on_setattr(struct inode *inode)
+{
+       return false;
+}
+
 static inline bool
 pnfs_roc(struct inode *ino)
 {