提交 47af81f2 编写于 作者: P Peng Tao 提交者: Tom Haynes

nfs: only reset desc->pg_mirror_idx when mirroring is supported

so that we don't reset desc->pg_mirror_idx for read unnecessarily.
Remove WARN_ON_ONCE from __nfs_pageio_add_request to allow LD to
set pg_mirror_idx for read where pg_mirror_count is always 1.
Signed-off-by: NPeng Tao <tao.peng@primarydata.com>
Signed-off-by: NTom Haynes <loghyr@primarydata.com>
上级 566f8737
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/mount.h> #include <linux/mount.h>
#include <linux/security.h> #include <linux/security.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/nfs_page.h>
#define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS) #define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS)
...@@ -261,6 +262,12 @@ static inline void nfs_iocounter_init(struct nfs_io_counter *c) ...@@ -261,6 +262,12 @@ static inline void nfs_iocounter_init(struct nfs_io_counter *c)
atomic_set(&c->io_count, 0); atomic_set(&c->io_count, 0);
} }
static inline bool nfs_pgio_has_mirroring(struct nfs_pageio_descriptor *desc)
{
WARN_ON_ONCE(desc->pg_mirror_count < 1);
return desc->pg_mirror_count > 1;
}
/* nfs2xdr.c */ /* nfs2xdr.c */
extern struct rpc_procinfo nfs_procedures[]; extern struct rpc_procinfo nfs_procedures[];
extern int nfs2_decode_dirent(struct xdr_stream *, extern int nfs2_decode_dirent(struct xdr_stream *,
......
...@@ -1021,8 +1021,6 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, ...@@ -1021,8 +1021,6 @@ static int __nfs_pageio_add_request(struct nfs_pageio_descriptor *desc,
unsigned int bytes_left = 0; unsigned int bytes_left = 0;
unsigned int offset, pgbase; unsigned int offset, pgbase;
WARN_ON_ONCE(desc->pg_mirror_idx >= desc->pg_mirror_count);
nfs_page_group_lock(req, false); nfs_page_group_lock(req, false);
subreq = req; subreq = req;
...@@ -1162,6 +1160,7 @@ int nfs_pageio_add_request(struct nfs_pageio_descriptor *desc, ...@@ -1162,6 +1160,7 @@ int nfs_pageio_add_request(struct nfs_pageio_descriptor *desc,
} else } else
dupreq = req; dupreq = req;
if (nfs_pgio_has_mirroring(desc))
desc->pg_mirror_idx = midx; desc->pg_mirror_idx = midx;
if (!nfs_pageio_add_request_mirror(desc, dupreq)) if (!nfs_pageio_add_request_mirror(desc, dupreq))
return 0; return 0;
...@@ -1181,6 +1180,7 @@ static void nfs_pageio_complete_mirror(struct nfs_pageio_descriptor *desc, ...@@ -1181,6 +1180,7 @@ static void nfs_pageio_complete_mirror(struct nfs_pageio_descriptor *desc,
struct nfs_pgio_mirror *mirror = &desc->pg_mirrors[mirror_idx]; struct nfs_pgio_mirror *mirror = &desc->pg_mirrors[mirror_idx];
u32 restore_idx = desc->pg_mirror_idx; u32 restore_idx = desc->pg_mirror_idx;
if (nfs_pgio_has_mirroring(desc))
desc->pg_mirror_idx = mirror_idx; desc->pg_mirror_idx = mirror_idx;
for (;;) { for (;;) {
nfs_pageio_doio(desc); nfs_pageio_doio(desc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册