mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paulo Alcantara <pc@manguebit.org>
To: David Howells <dhowells@redhat.com>,
	Steve French <sfrench@samba.org>,
	Enzo Matsumiya <ematsumiya@suse.de>
Cc: dhowells@redhat.com, Shyam Prasad N <sprasad@microsoft.com>,
	Tom Talpey <tom@talpey.com>,
	linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cifs: Fix collect_sample() to handle any iterator type
Date: Mon, 11 Aug 2025 09:25:23 -0300	[thread overview]
Message-ID: <9ab64c5bd90474a5e57c73cc0c48f612@manguebit.org> (raw)
In-Reply-To: <324664.1754897644@warthog.procyon.org.uk>

David Howells <dhowells@redhat.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@redhat.com>
> cc: Steve French <sfrench@samba.org>
> cc: Enzo Matsumiya <ematsumiya@suse.de>
> cc: Paulo Alcantara <pc@manguebit.org>
> cc: Shyam Prasad N <sprasad@microsoft.com>
> cc: Tom Talpey <tom@talpey.com>
> cc: linux-cifs@vger.kernel.org
> cc: linux-fsdevel@vger.kernel.org
> ---
>  fs/smb/client/compress.c |   71 +++++++++++++----------------------------------
>  1 file changed, 21 insertions(+), 50 deletions(-)

Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>

      reply	other threads:[~2025-08-11 12:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11  7:34 David Howells
2025-08-11 12:25 ` Paulo Alcantara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ab64c5bd90474a5e57c73cc0c48f612@manguebit.org \
    --to=pc@manguebit.org \
    --cc=dhowells@redhat.com \
    --cc=ematsumiya@suse.de \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfrench@samba.org \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®