aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Haynes <thomas.haynes@primarydata.com>2016-05-25 10:31:12 -0400
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2016-05-25 13:35:20 -0400
commitfb1084e3320555eca0fb86c9eaad5429ee761282 (patch)
treeaf933ba8ce9a6e2fc1f136c62350055bcb29c2ec
parentade8febde0271513360bac44883dbebad44276c3 (diff)
nfs/flexfiles: Helper function to detect FF_FLAGS_NO_READ_IO
The mds can inform the client not to use the IOMODE_RW layout segment for doing READs. I.e., it is basically a IOMODE_WRITE layout segment. It would do this to not interfere with the WRITEs. Signed-off-by: Tom Haynes <loghyr@primarydata.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r--fs/nfs/flexfilelayout/flexfilelayout.h11
-rw-r--r--fs/nfs/flexfilelayout/flexfilelayoutdev.c6
2 files changed, 16 insertions, 1 deletions
diff --git a/fs/nfs/flexfilelayout/flexfilelayout.h b/fs/nfs/flexfilelayout/flexfilelayout.h
index b54058122647..1bcdb15d0c41 100644
--- a/fs/nfs/flexfilelayout/flexfilelayout.h
+++ b/fs/nfs/flexfilelayout/flexfilelayout.h
@@ -10,7 +10,8 @@
10#define FS_NFS_NFS4FLEXFILELAYOUT_H 10#define FS_NFS_NFS4FLEXFILELAYOUT_H
11 11
12#define FF_FLAGS_NO_LAYOUTCOMMIT 1 12#define FF_FLAGS_NO_LAYOUTCOMMIT 1
13#define FF_FLAGS_NO_IO_THRU_MDS 2 13#define FF_FLAGS_NO_IO_THRU_MDS 2
14#define FF_FLAGS_NO_READ_IO 4
14 15
15#include "../pnfs.h" 16#include "../pnfs.h"
16 17
@@ -153,6 +154,12 @@ ff_layout_no_fallback_to_mds(struct pnfs_layout_segment *lseg)
153} 154}
154 155
155static inline bool 156static inline bool
157ff_layout_no_read_on_rw(struct pnfs_layout_segment *lseg)
158{
159 return FF_LAYOUT_LSEG(lseg)->flags & FF_FLAGS_NO_READ_IO;
160}
161
162static inline bool
156ff_layout_test_devid_unavailable(struct nfs4_deviceid_node *node) 163ff_layout_test_devid_unavailable(struct nfs4_deviceid_node *node)
157{ 164{
158 return nfs4_test_deviceid_unavailable(node); 165 return nfs4_test_deviceid_unavailable(node);
@@ -192,4 +199,6 @@ struct rpc_cred *ff_layout_get_ds_cred(struct pnfs_layout_segment *lseg,
192 u32 ds_idx, struct rpc_cred *mdscred); 199 u32 ds_idx, struct rpc_cred *mdscred);
193bool ff_layout_has_available_ds(struct pnfs_layout_segment *lseg); 200bool ff_layout_has_available_ds(struct pnfs_layout_segment *lseg);
194bool ff_layout_avoid_mds_available_ds(struct pnfs_layout_segment *lseg); 201bool ff_layout_avoid_mds_available_ds(struct pnfs_layout_segment *lseg);
202bool ff_layout_avoid_read_on_rw(struct pnfs_layout_segment *lseg);
203
195#endif /* FS_NFS_NFS4FLEXFILELAYOUT_H */ 204#endif /* FS_NFS_NFS4FLEXFILELAYOUT_H */
diff --git a/fs/nfs/flexfilelayout/flexfilelayoutdev.c b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
index 35d84d0c0f21..0aa36be71fce 100644
--- a/fs/nfs/flexfilelayout/flexfilelayoutdev.c
+++ b/fs/nfs/flexfilelayout/flexfilelayoutdev.c
@@ -557,6 +557,12 @@ bool ff_layout_avoid_mds_available_ds(struct pnfs_layout_segment *lseg)
557 ff_layout_has_available_ds(lseg); 557 ff_layout_has_available_ds(lseg);
558} 558}
559 559
560bool ff_layout_avoid_read_on_rw(struct pnfs_layout_segment *lseg)
561{
562 return lseg->pls_range.iomode == IOMODE_RW &&
563 ff_layout_no_read_on_rw(lseg);
564}
565
560module_param(dataserver_retrans, uint, 0644); 566module_param(dataserver_retrans, uint, 0644);
561MODULE_PARM_DESC(dataserver_retrans, "The number of times the NFSv4.1 client " 567MODULE_PARM_DESC(dataserver_retrans, "The number of times the NFSv4.1 client "
562 "retries a request before it attempts further " 568 "retries a request before it attempts further "