diff options
| author | Steve French <sfrench@localhost.localdomain> | 2014-07-19 22:44:58 -0400 |
|---|---|---|
| committer | Steve French <smfrench@gmail.com> | 2014-08-05 13:53:37 -0400 |
| commit | f29ebb47d5bb59ef246966b047356c03629a9705 (patch) | |
| tree | 1f76c55754b4c69384eb0c101644fbb548f117fd | |
| parent | 59b04c5df75bd715002bb535930ae1982a739269 (diff) | |
Add worker function to set allocation size
Adds setinfo worker function for SMB2/SMB3 support of SET_ALLOCATION_INFORMATION
Signed-off-by: Steve French <smfrench@gmail.com>
Reviewed-by: Pavel Shilovsky <pshilovsky@samba.org>
| -rw-r--r-- | fs/cifs/smb2inode.c | 2 | ||||
| -rw-r--r-- | fs/cifs/smb2ops.c | 3 | ||||
| -rw-r--r-- | fs/cifs/smb2pdu.c | 10 | ||||
| -rw-r--r-- | fs/cifs/smb2proto.h | 2 |
4 files changed, 11 insertions, 6 deletions
diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c index 84c012a6aba0..0150182a4494 100644 --- a/fs/cifs/smb2inode.c +++ b/fs/cifs/smb2inode.c | |||
| @@ -91,7 +91,7 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 91 | case SMB2_OP_SET_EOF: | 91 | case SMB2_OP_SET_EOF: |
| 92 | tmprc = SMB2_set_eof(xid, tcon, fid.persistent_fid, | 92 | tmprc = SMB2_set_eof(xid, tcon, fid.persistent_fid, |
| 93 | fid.volatile_fid, current->tgid, | 93 | fid.volatile_fid, current->tgid, |
| 94 | (__le64 *)data); | 94 | (__le64 *)data, false); |
| 95 | break; | 95 | break; |
| 96 | case SMB2_OP_SET_INFO: | 96 | case SMB2_OP_SET_INFO: |
| 97 | tmprc = SMB2_set_info(xid, tcon, fid.persistent_fid, | 97 | tmprc = SMB2_set_info(xid, tcon, fid.persistent_fid, |
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index d0210a8e9829..77f8aeb9c2fc 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | #include <linux/pagemap.h> | 20 | #include <linux/pagemap.h> |
| 21 | #include <linux/vfs.h> | 21 | #include <linux/vfs.h> |
| 22 | #include <linux/falloc.h> | ||
| 22 | #include "cifsglob.h" | 23 | #include "cifsglob.h" |
| 23 | #include "smb2pdu.h" | 24 | #include "smb2pdu.h" |
| 24 | #include "smb2proto.h" | 25 | #include "smb2proto.h" |
| @@ -736,7 +737,7 @@ smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 736 | { | 737 | { |
| 737 | __le64 eof = cpu_to_le64(size); | 738 | __le64 eof = cpu_to_le64(size); |
| 738 | return SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, | 739 | return SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, |
| 739 | cfile->fid.volatile_fid, cfile->pid, &eof); | 740 | cfile->fid.volatile_fid, cfile->pid, &eof, false); |
| 740 | } | 741 | } |
| 741 | 742 | ||
| 742 | static int | 743 | static int |
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index cde943d61fb6..42ebc1a8be6c 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
| @@ -2361,7 +2361,7 @@ SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 2361 | 2361 | ||
| 2362 | int | 2362 | int |
| 2363 | SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, | 2363 | SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, |
| 2364 | u64 volatile_fid, u32 pid, __le64 *eof) | 2364 | u64 volatile_fid, u32 pid, __le64 *eof, bool is_falloc) |
| 2365 | { | 2365 | { |
| 2366 | struct smb2_file_eof_info info; | 2366 | struct smb2_file_eof_info info; |
| 2367 | void *data; | 2367 | void *data; |
| @@ -2372,8 +2372,12 @@ SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, | |||
| 2372 | data = &info; | 2372 | data = &info; |
| 2373 | size = sizeof(struct smb2_file_eof_info); | 2373 | size = sizeof(struct smb2_file_eof_info); |
| 2374 | 2374 | ||
| 2375 | return send_set_info(xid, tcon, persistent_fid, volatile_fid, pid, | 2375 | if (is_falloc) |
| 2376 | FILE_END_OF_FILE_INFORMATION, 1, &data, &size); | 2376 | return send_set_info(xid, tcon, persistent_fid, volatile_fid, |
| 2377 | pid, FILE_ALLOCATION_INFORMATION, 1, &data, &size); | ||
| 2378 | else | ||
| 2379 | return send_set_info(xid, tcon, persistent_fid, volatile_fid, | ||
| 2380 | pid, FILE_END_OF_FILE_INFORMATION, 1, &data, &size); | ||
| 2377 | } | 2381 | } |
| 2378 | 2382 | ||
| 2379 | int | 2383 | int |
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h index 0ce48db20a65..67e8ce8055de 100644 --- a/fs/cifs/smb2proto.h +++ b/fs/cifs/smb2proto.h | |||
| @@ -139,7 +139,7 @@ extern int SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 139 | __le16 *target_file); | 139 | __le16 *target_file); |
| 140 | extern int SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, | 140 | extern int SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, |
| 141 | u64 persistent_fid, u64 volatile_fid, u32 pid, | 141 | u64 persistent_fid, u64 volatile_fid, u32 pid, |
| 142 | __le64 *eof); | 142 | __le64 *eof, bool is_fallocate); |
| 143 | extern int SMB2_set_info(const unsigned int xid, struct cifs_tcon *tcon, | 143 | extern int SMB2_set_info(const unsigned int xid, struct cifs_tcon *tcon, |
| 144 | u64 persistent_fid, u64 volatile_fid, | 144 | u64 persistent_fid, u64 volatile_fid, |
| 145 | FILE_BASIC_INFO *buf); | 145 | FILE_BASIC_INFO *buf); |
