提交 1bfe3b25 编写于 作者: P Peng Tao 提交者: Trond Myklebust

nfs42: serialize LAYOUTSTATS calls of the same file

There is no need to report concurrently.
Reviewed-by: NJeff Layton <jeff.layton@primarydata.com>
Signed-off-by: NPeng Tao <tao.peng@primarydata.com>
Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
上级 27c43064
...@@ -204,6 +204,9 @@ nfs42_layoutstat_release(void *calldata) ...@@ -204,6 +204,9 @@ nfs42_layoutstat_release(void *calldata)
nfss->pnfs_curr_ld->cleanup_layoutstats(data); nfss->pnfs_curr_ld->cleanup_layoutstats(data);
pnfs_put_layout_hdr(NFS_I(data->args.inode)->layout); pnfs_put_layout_hdr(NFS_I(data->args.inode)->layout);
smp_mb__before_atomic();
clear_bit(NFS_INO_LAYOUTSTATS, &NFS_I(data->args.inode)->flags);
smp_mb__after_atomic();
nfs_iput_and_deactive(data->inode); nfs_iput_and_deactive(data->inode);
kfree(data->args.devinfo); kfree(data->args.devinfo);
kfree(data); kfree(data);
......
...@@ -2257,6 +2257,7 @@ pnfs_report_layoutstat(struct inode *inode) ...@@ -2257,6 +2257,7 @@ pnfs_report_layoutstat(struct inode *inode)
{ {
struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld; struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
struct nfs_server *server = NFS_SERVER(inode); struct nfs_server *server = NFS_SERVER(inode);
struct nfs_inode *nfsi = NFS_I(inode);
struct nfs42_layoutstat_data *data; struct nfs42_layoutstat_data *data;
struct pnfs_layout_hdr *hdr; struct pnfs_layout_hdr *hdr;
int status = 0; int status = 0;
...@@ -2264,6 +2265,9 @@ pnfs_report_layoutstat(struct inode *inode) ...@@ -2264,6 +2265,9 @@ pnfs_report_layoutstat(struct inode *inode)
if (!pnfs_enabled_sb(server) || !ld->prepare_layoutstats) if (!pnfs_enabled_sb(server) || !ld->prepare_layoutstats)
goto out; goto out;
if (test_and_set_bit(NFS_INO_LAYOUTSTATS, &nfsi->flags))
goto out;
spin_lock(&inode->i_lock); spin_lock(&inode->i_lock);
if (!NFS_I(inode)->layout) { if (!NFS_I(inode)->layout) {
spin_unlock(&inode->i_lock); spin_unlock(&inode->i_lock);
...@@ -2296,6 +2300,9 @@ pnfs_report_layoutstat(struct inode *inode) ...@@ -2296,6 +2300,9 @@ pnfs_report_layoutstat(struct inode *inode)
kfree(data); kfree(data);
out_put: out_put:
pnfs_put_layout_hdr(hdr); pnfs_put_layout_hdr(hdr);
smp_mb__before_atomic();
clear_bit(NFS_INO_LAYOUTSTATS, &nfsi->flags);
smp_mb__after_atomic();
goto out; goto out;
} }
EXPORT_SYMBOL_GPL(pnfs_report_layoutstat); EXPORT_SYMBOL_GPL(pnfs_report_layoutstat);
...@@ -219,6 +219,7 @@ struct nfs_inode { ...@@ -219,6 +219,7 @@ struct nfs_inode {
#define NFS_INO_COMMIT (7) /* inode is committing unstable writes */ #define NFS_INO_COMMIT (7) /* inode is committing unstable writes */
#define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */ #define NFS_INO_LAYOUTCOMMIT (9) /* layoutcommit required */
#define NFS_INO_LAYOUTCOMMITTING (10) /* layoutcommit inflight */ #define NFS_INO_LAYOUTCOMMITTING (10) /* layoutcommit inflight */
#define NFS_INO_LAYOUTSTATS (11) /* layoutstats inflight */
static inline struct nfs_inode *NFS_I(const struct inode *inode) static inline struct nfs_inode *NFS_I(const struct inode *inode)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册