diff options
| author | Enzo Matsumiya <ematsumiya@suse.de> | 2024-11-14 14:12:27 -0300 |
|---|---|---|
| committer | Enzo Matsumiya <ematsumiya@suse.de> | 2024-11-14 15:54:45 -0300 |
| commit | 9ea3053596f7d4d63b80e28d0ed1ce5cab9a9457 (patch) | |
| tree | aceb632e5551e0cd48c65ac3d8f12dd5bd9f0c94 | |
| parent | 876aaa2b5597dae361b18a9c080aa50d381a86ca (diff) | |
| download | linux-9ea3053596f7d4d63b80e28d0ed1ce5cab9a9457.tar.gz linux-9ea3053596f7d4d63b80e28d0ed1ce5cab9a9457.tar.bz2 linux-9ea3053596f7d4d63b80e28d0ed1ce5cab9a9457.zip | |
smb: client: remove ->fallocate op
Expose smb3_fallocate() and use it directly instead.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
| -rw-r--r-- | fs/smb/client/cifsfs.c | 4 | ||||
| -rw-r--r-- | fs/smb/client/cifsglob.h | 2 | ||||
| -rw-r--r-- | fs/smb/client/smb2ops.c | 22 | ||||
| -rw-r--r-- | fs/smb/client/smb2proto.h | 2 |
4 files changed, 17 insertions, 13 deletions
diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c index 416366c35256..96c21b1661c6 100644 --- a/fs/smb/client/cifsfs.c +++ b/fs/smb/client/cifsfs.c @@ -330,8 +330,8 @@ static long cifs_fallocate(struct file *file, int mode, loff_t off, loff_t len) struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb); struct TCP_Server_Info *server = tcon->ses->server; - if (server->ops->fallocate) - return server->ops->fallocate(file, tcon, mode, off, len); + if (server->vals->protocol_id >= SMB30_PROT_ID) + return smb3_fallocate(file, tcon, mode, off, len); return -EOPNOTSUPP; } diff --git a/fs/smb/client/cifsglob.h b/fs/smb/client/cifsglob.h index 900709fe809a..0c92cc0caef0 100644 --- a/fs/smb/client/cifsglob.h +++ b/fs/smb/client/cifsglob.h @@ -302,8 +302,6 @@ struct smb_version_operations { struct TCP_Server_Info *server); int (*calc_signature)(struct smb_rqst *, struct TCP_Server_Info *, bool allocate_crypto); - long (*fallocate)(struct file *, struct cifs_tcon *, int, loff_t, - loff_t); /* init transform request - used for encryption for now */ int (*init_transform_rq)(struct TCP_Server_Info *, int num_rqst, struct smb_rqst *, struct smb_rqst *); diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c index f6140bf1641e..d6fcff6aefac 100644 --- a/fs/smb/client/smb2ops.c +++ b/fs/smb/client/smb2ops.c @@ -3823,23 +3823,29 @@ int smb3_fiemap(struct cifs_tcon *tcon, return rc; } -static long smb3_fallocate(struct file *file, struct cifs_tcon *tcon, int mode, - loff_t off, loff_t len) +long smb3_fallocate(struct file *file, struct cifs_tcon *tcon, int mode, loff_t off, loff_t len) { /* KEEP_SIZE already checked for by do_fallocate */ if (mode & FALLOC_FL_PUNCH_HOLE) return smb3_punch_hole(file, tcon, off, len); - else if (mode & FALLOC_FL_ZERO_RANGE) { + + if (mode & FALLOC_FL_ZERO_RANGE) { if (mode & FALLOC_FL_KEEP_SIZE) return smb3_zero_range(file, tcon, off, len, true); + return smb3_zero_range(file, tcon, off, len, false); - } else if (mode == FALLOC_FL_KEEP_SIZE) + } + + if (mode == FALLOC_FL_KEEP_SIZE) return smb3_simple_falloc(file, tcon, off, len, true); - else if (mode == FALLOC_FL_COLLAPSE_RANGE) + + if (mode == FALLOC_FL_COLLAPSE_RANGE) return smb3_collapse_range(file, tcon, off, len); - else if (mode == FALLOC_FL_INSERT_RANGE) + + if (mode == FALLOC_FL_INSERT_RANGE) return smb3_insert_range(file, tcon, off, len); - else if (mode == 0) + + if (mode == 0) return smb3_simple_falloc(file, tcon, off, len, false); return -EOPNOTSUPP; @@ -5012,7 +5018,6 @@ struct smb_version_operations smb30_operations = { .queryfs = smb2_queryfs, .generate_signingkey = generate_smb30signingkey, .calc_signature = smb3_calc_signature, - .fallocate = smb3_fallocate, .init_transform_rq = smb3_init_transform_rq, .is_transform_hdr = smb3_is_transform_hdr, .receive_transform = smb3_receive_transform, @@ -5029,7 +5034,6 @@ struct smb_version_operations smb311_operations = { .queryfs = smb311_queryfs, .generate_signingkey = generate_smb311signingkey, .calc_signature = smb3_calc_signature, - .fallocate = smb3_fallocate, .init_transform_rq = smb3_init_transform_rq, .is_transform_hdr = smb3_is_transform_hdr, .receive_transform = smb3_receive_transform, diff --git a/fs/smb/client/smb2proto.h b/fs/smb/client/smb2proto.h index a28b85b083f9..03c6e42f232f 100644 --- a/fs/smb/client/smb2proto.h +++ b/fs/smb/client/smb2proto.h @@ -501,6 +501,8 @@ extern int smb2_make_node(unsigned int xid, dev_t device_number); extern int smb3_fiemap(struct cifs_tcon *tcon, struct cifsFileInfo *, struct fiemap_extent_info *, u64, u64); +extern long smb3_fallocate(struct file *file, struct cifs_tcon *tcon, int mode, loff_t off, + loff_t len); extern loff_t smb3_llseek(struct file *, struct cifs_tcon *, loff_t, int); extern bool smb2_is_status_io_timeout(char *buf); |
