Skip to content

Commit f83e10a

Browse files
dhowellsSteve French
authored andcommitted
cifs: Remove cifs_truncate_page() as it should be superfluous
The calls to cifs_truncate_page() should be superfluous as the places that call it also call truncate_setsize() or cifs_setsize() and therefore truncate_pagecache() which should also clear the tail part of the folio containing the EOF marker. Further, smb3_simple_falloc() calls both cifs_setsize() and truncate_setsize() in addition to cifs_truncate_page(). Remove the superfluous calls. This gets rid of another function referring to struct page. [Should cifs_setsize() also set inode->i_blocks?] Signed-off-by: David Howells <[email protected]> cc: Steve French <[email protected]> Reviewed-by: Paulo Alcantara (Red Hat) <[email protected]> cc: Matthew Wilcox <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] Signed-off-by: Steve French <[email protected]>
1 parent e97aec7 commit f83e10a

File tree

3 files changed

+0
-22
lines changed

3 files changed

+0
-22
lines changed

fs/smb/client/cifsfs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ extern ssize_t cifs_file_copychunk_range(unsigned int xid,
135135

136136
extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
137137
extern void cifs_setsize(struct inode *inode, loff_t offset);
138-
extern int cifs_truncate_page(struct address_space *mapping, loff_t from);
139138

140139
struct smb3_fs_context;
141140
extern struct dentry *cifs_smb3_do_mount(struct file_system_type *fs_type,

fs/smb/client/inode.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2901,23 +2901,6 @@ int cifs_fiemap(struct inode *inode, struct fiemap_extent_info *fei, u64 start,
29012901
return -EOPNOTSUPP;
29022902
}
29032903

2904-
int cifs_truncate_page(struct address_space *mapping, loff_t from)
2905-
{
2906-
pgoff_t index = from >> PAGE_SHIFT;
2907-
unsigned offset = from & (PAGE_SIZE - 1);
2908-
struct page *page;
2909-
int rc = 0;
2910-
2911-
page = grab_cache_page(mapping, index);
2912-
if (!page)
2913-
return -ENOMEM;
2914-
2915-
zero_user_segment(page, offset, PAGE_SIZE);
2916-
unlock_page(page);
2917-
put_page(page);
2918-
return rc;
2919-
}
2920-
29212904
void cifs_setsize(struct inode *inode, loff_t offset)
29222905
{
29232906
struct cifsInodeInfo *cifs_i = CIFS_I(inode);
@@ -3012,8 +2995,6 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
30122995
*/
30132996
attrs->ia_ctime = attrs->ia_mtime = current_time(inode);
30142997
attrs->ia_valid |= ATTR_CTIME | ATTR_MTIME;
3015-
3016-
cifs_truncate_page(inode->i_mapping, inode->i_size);
30172998
}
30182999

30193000
return rc;

fs/smb/client/smb2ops.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3534,8 +3534,6 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
35343534
if (rc == 0) {
35353535
netfs_resize_file(&cifsi->netfs, new_eof, true);
35363536
cifs_setsize(inode, new_eof);
3537-
cifs_truncate_page(inode->i_mapping, inode->i_size);
3538-
truncate_setsize(inode, new_eof);
35393537
}
35403538
goto out;
35413539
}

0 commit comments

Comments
 (0)