mirror of
https://github.com/torvalds/linux.git
synced 2026-07-29 02:31:27 +02:00
smb/server: get compression format in get_file_compression_info()
I have added `filecompressioninfo` subcommand to `smbinfo`
in cifs-utils.git.
Example:
1. client: smbinfo setcompression lznt1 /mnt/file
2. client: smbinfo filecompressioninfo /mnt/file
Compressed File Size: 104857600
Compression Format: 2 (LZNT1)
Compression Unit Shift: 0
Chunk Shift: 0
Cluster Shift: 0
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
7eeb7b6772
commit
5560f97164
|
|
@ -5279,6 +5279,7 @@ static int get_file_compression_info(struct smb2_query_info_rsp *rsp,
|
|||
{
|
||||
struct smb2_file_comp_info *file_info;
|
||||
struct kstat stat;
|
||||
u16 fmt;
|
||||
int ret;
|
||||
|
||||
ret = vfs_getattr(&fp->filp->f_path, &stat, STATX_BASIC_STATS,
|
||||
|
|
@ -5286,9 +5287,13 @@ static int get_file_compression_info(struct smb2_query_info_rsp *rsp,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = ksmbd_vfs_get_compression(fp, &fmt);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
file_info = (struct smb2_file_comp_info *)rsp->Buffer;
|
||||
file_info->CompressedFileSize = cpu_to_le64(stat.blocks << 9);
|
||||
file_info->CompressionFormat = COMPRESSION_FORMAT_NONE;
|
||||
file_info->CompressionFormat = cpu_to_le16(fmt);
|
||||
file_info->CompressionUnitShift = 0;
|
||||
file_info->ChunkShift = 0;
|
||||
file_info->ClusterShift = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user