Re: [PATCH] cifs: Remove cifs_truncate_page() as it should be superfluous
From: Paulo Alcantara
Date: Wed Apr 02 2025 - 11:33:45 EST
David Howells <dhowells@xxxxxxxxxx> writes:
> 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?]
I don't think that's necessary as the current inode will be marked for
revalidation (e.g. cifsInodeInfo::time is set to 0), so next call to
cifs_fattr_to_inode() will update inode->i_blocks. If it isn't being
updated, then I'm missing something else.
> Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
> cc: Steve French <stfrench@xxxxxxxxxxxxx>
> cc: Paulo Alcantara (Red Hat) <pc@xxxxxxxxxxxxx>
> cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
> cc: linux-cifs@xxxxxxxxxxxxxxx
> cc: netfs@xxxxxxxxxxxxxxx
> cc: linux-fsdevel@xxxxxxxxxxxxxxx
> ---
> fs/smb/client/cifsfs.h | 1 -
> fs/smb/client/inode.c | 19 -------------------
> fs/smb/client/smb2ops.c | 2 --
> 3 files changed, 22 deletions(-)
Looks good,
Reviewed-by: Paulo Alcantara (Red Hat) <pc@xxxxxxxxxxxxx>