Merge branch 'flexfiles'
authorTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 3 Feb 2015 21:01:27 +0000 (16:01 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 3 Feb 2015 21:01:27 +0000 (16:01 -0500)
* flexfiles: (53 commits)
  pnfs: lookup new lseg at lseg boundary
  nfs41: .init_read and .init_write can be called with valid pg_lseg
  pnfs: Update documentation on the Layout Drivers
  pnfs/flexfiles: Add the FlexFile Layout Driver
  nfs: count DIO good bytes correctly with mirroring
  nfs41: wait for LAYOUTRETURN before retrying LAYOUTGET
  nfs: add a helper to set NFS_ODIRECT_RESCHED_WRITES to direct writes
  nfs41: add NFS_LAYOUT_RETRY_LAYOUTGET to layout header flags
  nfs/flexfiles: send layoutreturn before freeing lseg
  nfs41: introduce NFS_LAYOUT_RETURN_BEFORE_CLOSE
  nfs41: allow async version layoutreturn
  nfs41: add range to layoutreturn args
  pnfs: allow LD to ask to resend read through pnfs
  nfs: add nfs_pgio_current_mirror helper
  nfs: only reset desc->pg_mirror_idx when mirroring is supported
  nfs41: add a debug warning if we destroy an unempty layout
  pnfs: fail comparison when bucket verifier not set
  nfs: mirroring support for direct io
  nfs: add mirroring support to pgio layer
  pnfs: pass ds_commit_idx through the commit path
  ...

Conflicts:
fs/nfs/pnfs.c
fs/nfs/pnfs.h

1  2 
fs/nfs/direct.c
fs/nfs/internal.h
fs/nfs/nfs4_fs.h
fs/nfs/nfs4client.c
fs/nfs/nfs4proc.c
fs/nfs/nfs4xdr.c
fs/nfs/pnfs.c
fs/nfs/pnfs.h
include/linux/nfs_xdr.h

diff --cc fs/nfs/direct.c
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc fs/nfs/pnfs.c
@@@ -955,31 -1066,18 +1067,34 @@@ pnfs_commit_and_return_layout(struct in
  
  bool pnfs_roc(struct inode *ino)
  {
 +      struct nfs_inode *nfsi = NFS_I(ino);
 +      struct nfs_open_context *ctx;
 +      struct nfs4_state *state;
        struct pnfs_layout_hdr *lo;
        struct pnfs_layout_segment *lseg, *tmp;
+       nfs4_stateid stateid;
        LIST_HEAD(tmp_list);
-       bool found = false;
+       bool found = false, layoutreturn = false;
  
        spin_lock(&ino->i_lock);
 -      lo = NFS_I(ino)->layout;
 +      lo = nfsi->layout;
        if (!lo || !test_and_clear_bit(NFS_LAYOUT_ROC, &lo->plh_flags) ||
            test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags))
 -              goto out_nolayout;
 +              goto out_noroc;
 +
 +      /* Don't return layout if we hold a delegation */
 +      if (nfs4_check_delegation(ino, FMODE_READ))
 +              goto out_noroc;
 +
 +      list_for_each_entry(ctx, &nfsi->open_files, list) {
 +              state = ctx->state;
 +              /* Don't return layout if there is open file state */
 +              if (state != NULL && state->state != 0)
 +                      goto out_noroc;
 +      }
 +
++              goto out_noroc;
+       pnfs_clear_retry_layoutget(lo);
        list_for_each_entry_safe(lseg, tmp, &lo->plh_segs, pls_list)
                if (test_bit(NFS_LSEG_ROC, &lseg->pls_flags)) {
                        mark_lseg_invalid(lseg, &tmp_list);
        pnfs_free_lseg_list(&tmp_list);
        return true;
  
 -out_nolayout:
 +out_noroc:
+       if (lo) {
+               stateid = lo->plh_stateid;
+               layoutreturn =
+                       test_and_clear_bit(NFS_LAYOUT_RETURN_BEFORE_CLOSE,
+                                          &lo->plh_flags);
+               if (layoutreturn) {
+                       lo->plh_block_lgets++;
+                       pnfs_get_layout_hdr(lo);
+               }
+       }
        spin_unlock(&ino->i_lock);
+       if (layoutreturn)
+               pnfs_send_layoutreturn(lo, stateid, IOMODE_ANY, true);
        return false;
  }
  
diff --cc fs/nfs/pnfs.h
@@@ -275,11 -317,34 +317,39 @@@ void nfs4_mark_deviceid_unavailable(str
  bool nfs4_test_deviceid_unavailable(struct nfs4_deviceid_node *node);
  void nfs4_deviceid_purge_client(const struct nfs_client *);
  
+ /* pnfs_nfs.c */
+ void pnfs_generic_clear_request_commit(struct nfs_page *req,
+                                      struct nfs_commit_info *cinfo);
+ void pnfs_generic_commit_release(void *calldata);
+ void pnfs_generic_prepare_to_resend_writes(struct nfs_commit_data *data);
+ void pnfs_generic_rw_release(void *data);
+ void pnfs_generic_recover_commit_reqs(struct list_head *dst,
+                                     struct nfs_commit_info *cinfo);
+ int pnfs_generic_commit_pagelist(struct inode *inode,
+                                struct list_head *mds_pages,
+                                int how,
+                                struct nfs_commit_info *cinfo,
+                                int (*initiate_commit)(struct nfs_commit_data *data,
+                                                       int how));
+ int pnfs_generic_scan_commit_lists(struct nfs_commit_info *cinfo, int max);
+ void pnfs_generic_write_commit_done(struct rpc_task *task, void *data);
+ void nfs4_pnfs_ds_put(struct nfs4_pnfs_ds *ds);
+ struct nfs4_pnfs_ds *nfs4_pnfs_ds_add(struct list_head *dsaddrs,
+                                     gfp_t gfp_flags);
+ void nfs4_pnfs_v3_ds_connect_unload(void);
+ void nfs4_pnfs_ds_connect(struct nfs_server *mds_srv, struct nfs4_pnfs_ds *ds,
+                         struct nfs4_deviceid_node *devid, unsigned int timeo,
+                         unsigned int retrans, u32 version, u32 minor_version,
+                         rpc_authflavor_t au_flavor);
+ struct nfs4_pnfs_ds_addr *nfs4_decode_mp_ds_addr(struct net *net,
+                                                struct xdr_stream *xdr,
+                                                gfp_t gfp_flags);
 +static inline bool nfs_have_layout(struct inode *inode)
 +{
 +      return NFS_I(inode)->layout != NULL;
 +}
 +
  static inline struct nfs4_deviceid_node *
  nfs4_get_deviceid(struct nfs4_deviceid_node *d)
  {
Simple merge