diff options
| author | David Howells <[email protected]> | 2025-07-01 16:38:46 +0000 |
|---|---|---|
| committer | Christian Brauner <[email protected]> | 2025-07-01 20:37:14 +0000 |
| commit | 5e1e6ec2e346c0850f304c31abdef4158007474e (patch) | |
| tree | 2f31407da4b90fe37338ce1f0fe87c58377edece /fs/netfs/write_collect.c | |
| parent | netfs: Fix i_size updating (diff) | |
| download | kernel-5e1e6ec2e346c0850f304c31abdef4158007474e.tar.gz kernel-5e1e6ec2e346c0850f304c31abdef4158007474e.zip | |
netfs: Merge i_size update functions
Netfslib has two functions for updating the i_size after a write: one for
buffered writes into the pagecache and one for direct/unbuffered writes.
However, what needs to be done is much the same in both cases, so merge
them together.
This does raise one question, though: should updating the i_size after a
direct write do the same estimated update of i_blocks as is done for
buffered writes.
Also get rid of the cleanup function pointer from netfs_io_request as it's
only used for direct write to update i_size; instead do the i_size setting
directly from write collection.
Signed-off-by: David Howells <[email protected]>
Link: https://lore.kernel.org/[email protected]
cc: Steve French <[email protected]>
cc: Paulo Alcantara <[email protected]>
cc: [email protected]
cc: [email protected]
cc: [email protected]
Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'fs/netfs/write_collect.c')
| -rw-r--r-- | fs/netfs/write_collect.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/netfs/write_collect.c b/fs/netfs/write_collect.c index 2ac85a819b71..33a93258f36e 100644 --- a/fs/netfs/write_collect.c +++ b/fs/netfs/write_collect.c @@ -393,8 +393,10 @@ bool netfs_write_collection(struct netfs_io_request *wreq) ictx->ops->invalidate_cache(wreq); } - if (wreq->cleanup) - wreq->cleanup(wreq); + if ((wreq->origin == NETFS_UNBUFFERED_WRITE || + wreq->origin == NETFS_DIO_WRITE) && + !wreq->error) + netfs_update_i_size(ictx, &ictx->inode, wreq->start, wreq->transferred); if (wreq->origin == NETFS_DIO_WRITE && wreq->mapping->nrpages) { |
