diff options
| author | Enzo Matsumiya <ematsumiya@suse.de> | 2024-11-14 13:59:08 -0300 |
|---|---|---|
| committer | Enzo Matsumiya <ematsumiya@suse.de> | 2024-11-14 15:54:45 -0300 |
| commit | 876aaa2b5597dae361b18a9c080aa50d381a86ca (patch) | |
| tree | 17fda6cce5c9ed4c3ca15151bd49340688fad1a9 | |
| parent | c1aade97026dd9766e871adc047d57b4b6907c3f (diff) | |
| download | linux-876aaa2b5597dae361b18a9c080aa50d381a86ca.tar.gz linux-876aaa2b5597dae361b18a9c080aa50d381a86ca.tar.bz2 linux-876aaa2b5597dae361b18a9c080aa50d381a86ca.zip | |
smb: client: remove ->duplicate_extents op
Expose it in smb2proto.h and update comment in trace.h.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
| -rw-r--r-- | fs/smb/client/cifsfs.c | 9 | ||||
| -rw-r--r-- | fs/smb/client/cifsglob.h | 3 | ||||
| -rw-r--r-- | fs/smb/client/smb2ops.c | 9 | ||||
| -rw-r--r-- | fs/smb/client/smb2proto.h | 2 | ||||
| -rw-r--r-- | fs/smb/client/trace.h | 2 |
5 files changed, 9 insertions, 16 deletions
diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index 990bb7d4caab..416366c35256 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -1286,14 +1286,13 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off, i_size_read(target_inode), 0); rc = -EOPNOTSUPP; - if (target_tcon->ses->server->ops->duplicate_extents) { - rc = target_tcon->ses->server->ops->duplicate_extents(xid, - smb_file_src, smb_file_target, off, len, destoff); + if (target_tcon->ses->server->vals->protocol_id >= SMB30_PROT_ID) { + rc = smb3_duplicate_extents(xid, smb_file_src, smb_file_target, off, len, destoff); if (rc == 0 && new_size > old_size) { truncate_setsize(target_inode, new_size); - fscache_resize_cookie(cifs_inode_cookie(target_inode), - new_size); + fscache_resize_cookie(cifs_inode_cookie(target_inode), new_size); } + if (rc == 0 && new_size > target_cifsi->netfs.zero_point) target_cifsi->netfs.zero_point = new_size; } diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index ac3b18d18003..900709fe809a 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -302,9 +302,6 @@ struct smb_version_operations { struct TCP_Server_Info *server); int (*calc_signature)(struct smb_rqst *, struct TCP_Server_Info *, bool allocate_crypto); - int (*duplicate_extents)(const unsigned int, struct cifsFileInfo *src, - struct cifsFileInfo *target_file, u64 src_off, u64 len, - u64 dest_off); long (*fallocate)(struct file *, struct cifs_tcon *, int, loff_t, loff_t); /* init transform request - used for encryption for now */ diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index 990e8c89b55d..f6140bf1641e 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -1979,11 +1979,8 @@ int smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon, cfile->fid.volatile_fid, cfile->pid, size); } -static int -smb2_duplicate_extents(const unsigned int xid, - struct cifsFileInfo *srcfile, - struct cifsFileInfo *trgtfile, u64 src_off, - u64 len, u64 dest_off) +int smb3_duplicate_extents(const unsigned int xid, struct cifsFileInfo *srcfile, + struct cifsFileInfo *trgtfile, u64 src_off, u64 len, u64 dest_off) { int rc; unsigned int ret_data_len; @@ -5015,7 +5012,6 @@ struct smb_version_operations smb30_operations = { .queryfs = smb2_queryfs, .generate_signingkey = generate_smb30signingkey, .calc_signature = smb3_calc_signature, - .duplicate_extents = smb2_duplicate_extents, .fallocate = smb3_fallocate, .init_transform_rq = smb3_init_transform_rq, .is_transform_hdr = smb3_is_transform_hdr, @@ -5033,7 +5029,6 @@ struct smb_version_operations smb311_operations = { .queryfs = smb311_queryfs, .generate_signingkey = generate_smb311signingkey, .calc_signature = smb3_calc_signature, - .duplicate_extents = smb2_duplicate_extents, .fallocate = smb3_fallocate, .init_transform_rq = smb3_init_transform_rq, .is_transform_hdr = smb3_is_transform_hdr, diff --git a/fs/smb/client/smb2proto.h b/fs/smb/client/smb2proto.h index a7a72bb38ac1..a28b85b083f9 100644 --- a/fs/smb/client/smb2proto.h +++ b/fs/smb/client/smb2proto.h @@ -390,6 +390,8 @@ extern int smb2_set_path_size(const unsigned int, struct cifs_tcon *, struct dentry *); extern int smb2_set_file_size(const unsigned int, struct cifs_tcon *, struct cifsFileInfo *, __u64, bool); +extern int smb3_duplicate_extents(const unsigned int xid, struct cifsFileInfo *srcfile, + struct cifsFileInfo *trgtfile, u64 src_off, u64 len, u64 dest_off); extern int smb2_set_compression(const unsigned int, struct cifs_tcon *, struct cifsFileInfo *); extern bool smb2_can_echo(struct TCP_Server_Info *); diff --git a/fs/smb/client/trace.h b/fs/smb/client/trace.h index 8e9964001e2a..aa43c296a910 100644 --- a/fs/smb/client/trace.h +++ b/fs/smb/client/trace.h @@ -209,7 +209,7 @@ DEFINE_SMB3_OTHER_ERR_EVENT(falloc_err); /* * For logging errors in reflink and copy_range ops e.g. smb2_copychunk_range - * and smb2_duplicate_extents + * and smb3_duplicate_extents */ DECLARE_EVENT_CLASS(smb3_copy_range_err_class, TP_PROTO(unsigned int xid, |
