Re: [PATCH] cifs: Fix collect_sample() to handle any iterator type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Howells <dhowells@xxxxxxxxxx> 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@xxxxxxxxxx>
> cc: Steve French <sfrench@xxxxxxxxx>
> cc: Enzo Matsumiya <ematsumiya@xxxxxxx>
> cc: Paulo Alcantara <pc@xxxxxxxxxxxxx>
> cc: Shyam Prasad N <sprasad@xxxxxxxxxxxxx>
> cc: Tom Talpey <tom@xxxxxxxxxx>
> cc: linux-cifs@xxxxxxxxxxxxxxx
> cc: linux-fsdevel@xxxxxxxxxxxxxxx
> ---
>  fs/smb/client/compress.c |   71 +++++++++++++----------------------------------
>  1 file changed, 21 insertions(+), 50 deletions(-)

Acked-by: Paulo Alcantara (Red Hat) <pc@xxxxxxxxxxxxx>




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux