summaryrefslogtreecommitdiff
path: root/fs/cachefiles
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2024-01-11 14:22:33 +0300
committerChristian Brauner <brauner@kernel.org>2024-01-11 14:22:33 +0300
commit1d5911d43cab5fb99229b02bce173b0c6d9da7d2 (patch)
treea123abfdbd076fefaccb3562becd890e075767db /fs/cachefiles
parentd271c4b406f75e27efd79fe132981e475db1dd7e (diff)
parente2bdb5272f4314256f51d91eee7babcae58b194b (diff)
downloadlinux-1d5911d43cab5fb99229b02bce173b0c6d9da7d2.tar.xz
Merge tag 'netfs-lib-20240109' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs into vfs.netfs
Pull netfs updates from David Howells: A few follow-up fixes for the netfs work for this cycle. * tag 'netfs-lib-20240109' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: netfs: Fix wrong #ifdef hiding wait cachefiles: Fix signed/unsigned mixup netfs: Fix the loop that unmarks folios after writing to the cache netfs: Fix interaction between write-streaming and cachefiles culling netfs: Count DIO writes netfs: Mark netfs_unbuffered_write_iter_locked() static Tested-by: Marc Dionne <marc.dionne@auristor.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/cachefiles')
-rw-r--r--fs/cachefiles/io.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/cachefiles/io.c b/fs/cachefiles/io.c
index 7529b40bc95a..9a2cb2868e90 100644
--- a/fs/cachefiles/io.c
+++ b/fs/cachefiles/io.c
@@ -522,18 +522,18 @@ int __cachefiles_prepare_write(struct cachefiles_object *object,
bool no_space_allocated_yet)
{
struct cachefiles_cache *cache = object->volume->cache;
- unsigned long long start = *_start, pos;
+ loff_t start = *_start, pos;
size_t len = *_len;
int ret;
/* Round to DIO size */
start = round_down(*_start, PAGE_SIZE);
- if (start != *_start) {
- kleave(" = -ENOBUFS [down]");
- return -ENOBUFS;
- }
- if (*_len > upper_len) {
- kleave(" = -ENOBUFS [up]");
+ if (start != *_start || *_len > upper_len) {
+ /* Probably asked to cache a streaming write written into the
+ * pagecache when the cookie was temporarily out of service to
+ * culling.
+ */
+ fscache_count_dio_misfit();
return -ENOBUFS;
}
@@ -556,7 +556,7 @@ int __cachefiles_prepare_write(struct cachefiles_object *object,
cachefiles_trace_seek_error);
return pos;
}
- if (pos >= start + *_len)
+ if ((u64)pos >= (u64)start + *_len)
goto check_space; /* Unallocated region */
/* We have a block that's at least partially filled - if we're low on
@@ -575,7 +575,7 @@ int __cachefiles_prepare_write(struct cachefiles_object *object,
cachefiles_trace_seek_error);
return pos;
}
- if (pos >= start + *_len)
+ if ((u64)pos >= (u64)start + *_len)
return 0; /* Fully allocated */
/* Partially allocated, but insufficient space: cull. */