Skip to contentSkip to conversation

cifs: add support for fallocate mode 0 for non-sparse files

PATCH New Ronnie Sahlberg 1 participant 1 message Jan 17, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cifs: add support for fallocate mode 0 for non-sparse files

RHBZ 1336264

When we extend a file we must also force the size to be updated.

This fixes an issue with holetest in xfs-tests which performs the following sequence :
1, create a new file
2, use fallocate mode==0 to populate the file
3, mmap the file
4, touch each page by reading the mmapped region.

---
 fs/cifs/cifsfs.h  |  3 +++
 fs/cifs/inode.c   |  4 ++--
 fs/cifs/smb2ops.c | 64 +++++++++++++++++++++++++------------------------------
 3 files changed, 34 insertions(+), 37 deletions(-)
fs/cifs/cifsfs.h +3 -0
index b59dc7478130..096a4c18fbd0 100644
@@ -149,6 +149,9 @@ extern ssize_t cifs_file_copychunk_range(unsigned int xid,
 					size_t len, unsigned int flags);
 
 extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
+extern void cifs_setsize(struct inode *inode, loff_t offset);
+extern int cifs_truncate_page(struct address_space *mapping, loff_t from);
+
 #ifdef CONFIG_CIFS_NFSD_EXPORT
 extern const struct export_operations cifs_export_ops;
 #endif /* CONFIG_CIFS_NFSD_EXPORT */
fs/cifs/inode.c +2 -2
index ca76a9287456..9b547f7f5f5d 100644
@@ -2228,7 +2228,7 @@ int cifs_fiemap(struct inode *inode, struct fiemap_extent_info *fei, u64 start,
 	return -ENOTSUPP;
 }
 
-static int cifs_truncate_page(struct address_space *mapping, loff_t from)
+int cifs_truncate_page(struct address_space *mapping, loff_t from)
 {
 	pgoff_t index = from >> PAGE_SHIFT;
 	unsigned offset = from & (PAGE_SIZE - 1);
@@ -2245,7 +2245,7 @@ static int cifs_truncate_page(struct address_space *mapping, loff_t from)
 	return rc;
 }
 
-static void cifs_setsize(struct inode *inode, loff_t offset)
+void cifs_setsize(struct inode *inode, loff_t offset)
 {
 	struct cifsInodeInfo *cifs_i = CIFS_I(inode);
 
fs/cifs/smb2ops.c +29 -35

88 lines not on this page · raw message

Signature · 1 line
2.13.6