aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <stfrench@microsoft.com>2018-10-11 02:01:02 -0400
committerSteve French <stfrench@microsoft.com>2018-10-23 22:16:05 -0400
commit0cb012d1a0a9ead759112da141698a2078fbf2ce (patch)
tree72a2b2387f9b5d5cafe3accfd62af28f6f2f6107
parentf70556c8cae976e50ba9c27dd4c1a86b57efc17d (diff)
cifs: track writepages in vfs operation counters
writepages and readpages operations did not call get/free_xid so the statistics for file copy could get confusing with "vfs operations" not increasing. Add get_xid and free_xid to cifs readpages and writepages functions. Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>
-rw-r--r--fs/cifs/file.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 00abaa1dce02..84477e995246 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -2107,6 +2107,7 @@ static int cifs_writepages(struct address_space *mapping,
2107 pgoff_t end, index; 2107 pgoff_t end, index;
2108 struct cifs_writedata *wdata; 2108 struct cifs_writedata *wdata;
2109 int rc = 0; 2109 int rc = 0;
2110 unsigned int xid;
2110 2111
2111 /* 2112 /*
2112 * If wsize is smaller than the page cache size, default to writing 2113 * If wsize is smaller than the page cache size, default to writing
@@ -2115,6 +2116,7 @@ static int cifs_writepages(struct address_space *mapping,
2115 if (cifs_sb->wsize < PAGE_SIZE) 2116 if (cifs_sb->wsize < PAGE_SIZE)
2116 return generic_writepages(mapping, wbc); 2117 return generic_writepages(mapping, wbc);
2117 2118
2119 xid = get_xid();
2118 if (wbc->range_cyclic) { 2120 if (wbc->range_cyclic) {
2119 index = mapping->writeback_index; /* Start from prev offset */ 2121 index = mapping->writeback_index; /* Start from prev offset */
2120 end = -1; 2122 end = -1;
@@ -2208,6 +2210,7 @@ retry:
2208 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0)) 2210 if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
2209 mapping->writeback_index = index; 2211 mapping->writeback_index = index;
2210 2212
2213 free_xid(xid);
2211 return rc; 2214 return rc;
2212} 2215}
2213 2216
@@ -3752,7 +3755,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
3752 struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file); 3755 struct cifs_sb_info *cifs_sb = CIFS_FILE_SB(file);
3753 struct TCP_Server_Info *server; 3756 struct TCP_Server_Info *server;
3754 pid_t pid; 3757 pid_t pid;
3758 unsigned int xid;
3755 3759
3760 xid = get_xid();
3756 /* 3761 /*
3757 * Reads as many pages as possible from fscache. Returns -ENOBUFS 3762 * Reads as many pages as possible from fscache. Returns -ENOBUFS
3758 * immediately if the cookie is negative 3763 * immediately if the cookie is negative
@@ -3762,8 +3767,10 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
3762 */ 3767 */
3763 rc = cifs_readpages_from_fscache(mapping->host, mapping, page_list, 3768 rc = cifs_readpages_from_fscache(mapping->host, mapping, page_list,
3764 &num_pages); 3769 &num_pages);
3765 if (rc == 0) 3770 if (rc == 0) {
3771 free_xid(xid);
3766 return rc; 3772 return rc;
3773 }
3767 3774
3768 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) 3775 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
3769 pid = open_file->pid; 3776 pid = open_file->pid;
@@ -3807,6 +3814,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
3807 */ 3814 */
3808 if (unlikely(rsize < PAGE_SIZE)) { 3815 if (unlikely(rsize < PAGE_SIZE)) {
3809 add_credits_and_wake_if(server, credits, 0); 3816 add_credits_and_wake_if(server, credits, 0);
3817 free_xid(xid);
3810 return 0; 3818 return 0;
3811 } 3819 }
3812 3820
@@ -3871,6 +3879,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
3871 * allocator. 3879 * allocator.
3872 */ 3880 */
3873 cifs_fscache_readpages_cancel(mapping->host, page_list); 3881 cifs_fscache_readpages_cancel(mapping->host, page_list);
3882 free_xid(xid);
3874 return rc; 3883 return rc;
3875} 3884}
3876 3885