[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <9ab64c5bd90474a5e57c73cc0c48f612@manguebit.org>
Date: Mon, 11 Aug 2025 09:25:23 -0300
From: Paulo Alcantara <pc@...guebit.org>
To: David Howells <dhowells@...hat.com>, Steve French <sfrench@...ba.org>,
Enzo Matsumiya <ematsumiya@...e.de>
Cc: dhowells@...hat.com, Shyam Prasad N <sprasad@...rosoft.com>, Tom Talpey
<tom@...pey.com>, linux-cifs@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cifs: Fix collect_sample() to handle any iterator type
David Howells <dhowells@...hat.com> writes:
> collect_sample() is used to gather samples of the data in a Write op for
> analysis to try and determine if the compression algorithm is likely to
> achieve anything more quickly than actually running the compression
> algorithm.
>
> However, collect_sample() assumes that the data it is going to be sampling
> is stored in an ITER_XARRAY-type iterator (which it now should never be)
> and doesn't actually check that it is before accessing the underlying
> xarray directly.
>
> Fix this by replacing the code with a loop that just uses the standard
> iterator functions to sample every other 2KiB block, skipping the
> intervening ones. It's not quite the same as the previous algorithm as it
> doesn't necessarily align to the pages within an ordinary write from the
> pagecache.
>
> Note that the btrfs code from which this was derived samples the inode's
> pagecache directly rather than the iterator - but that doesn't necessarily
> work for network filesystems if O_DIRECT is in operation.
>
> Fixes: 94ae8c3fee94 ("smb: client: compress: LZ77 code improvements cleanup")
> Signed-off-by: David Howells <dhowells@...hat.com>
> cc: Steve French <sfrench@...ba.org>
> cc: Enzo Matsumiya <ematsumiya@...e.de>
> cc: Paulo Alcantara <pc@...guebit.org>
> cc: Shyam Prasad N <sprasad@...rosoft.com>
> cc: Tom Talpey <tom@...pey.com>
> cc: linux-cifs@...r.kernel.org
> cc: linux-fsdevel@...r.kernel.org
> ---
> fs/smb/client/compress.c | 71 +++++++++++++----------------------------------
> 1 file changed, 21 insertions(+), 50 deletions(-)
Acked-by: Paulo Alcantara (Red Hat) <pc@...guebit.org>
Powered by blists - more mailing lists