Add worker function to set allocation size
authorSteve French <sfrench@localhost.localdomain>
Sun, 20 Jul 2014 02:44:58 +0000 (21:44 -0500)
committerSteve French <smfrench@gmail.com>
Tue, 5 Aug 2014 17:53:37 +0000 (12:53 -0500)
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>
fs/cifs/smb2inode.c
fs/cifs/smb2ops.c
fs/cifs/smb2pdu.c
fs/cifs/smb2proto.h

index 84c012a6aba01fc9a7fcd82ab3548047da63d55b..0150182a44946dcebdb9aae71130f7c8a479eab9 100644 (file)
@@ -91,7 +91,7 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
        case SMB2_OP_SET_EOF:
                tmprc = SMB2_set_eof(xid, tcon, fid.persistent_fid,
                                     fid.volatile_fid, current->tgid,
-                                    (__le64 *)data);
+                                    (__le64 *)data, false);
                break;
        case SMB2_OP_SET_INFO:
                tmprc = SMB2_set_info(xid, tcon, fid.persistent_fid,
index d0210a8e9829d58b4257fde5b8798eafa441352c..77f8aeb9c2fc7ecb9a2c45785a65d6e9a45700fa 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <linux/pagemap.h>
 #include <linux/vfs.h>
+#include <linux/falloc.h>
 #include "cifsglob.h"
 #include "smb2pdu.h"
 #include "smb2proto.h"
@@ -736,7 +737,7 @@ smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon,
 {
        __le64 eof = cpu_to_le64(size);
        return SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid,
-                           cfile->fid.volatile_fid, cfile->pid, &eof);
+                           cfile->fid.volatile_fid, cfile->pid, &eof, false);
 }
 
 static int
index cde943d61fb673b9c55a79a2bce5a35f23bf75c6..42ebc1a8be6cb241c5ee77e1944f063ae15a472d 100644 (file)
@@ -2361,7 +2361,7 @@ SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
 
 int
 SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
-            u64 volatile_fid, u32 pid, __le64 *eof)
+            u64 volatile_fid, u32 pid, __le64 *eof, bool is_falloc)
 {
        struct smb2_file_eof_info info;
        void *data;
@@ -2372,8 +2372,12 @@ SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
        data = &info;
        size = sizeof(struct smb2_file_eof_info);
 
-       return send_set_info(xid, tcon, persistent_fid, volatile_fid, pid,
-                            FILE_END_OF_FILE_INFORMATION, 1, &data, &size);
+       if (is_falloc)
+               return send_set_info(xid, tcon, persistent_fid, volatile_fid,
+                       pid, FILE_ALLOCATION_INFORMATION, 1, &data, &size);
+       else
+               return send_set_info(xid, tcon, persistent_fid, volatile_fid,
+                       pid, FILE_END_OF_FILE_INFORMATION, 1, &data, &size);
 }
 
 int
index 0ce48db20a6511add52f9b44f5cbf664a178e41f..67e8ce8055def7743fd1204b311eda090b3e1fc1 100644 (file)
@@ -139,7 +139,7 @@ extern int SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
                             __le16 *target_file);
 extern int SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon,
                        u64 persistent_fid, u64 volatile_fid, u32 pid,
-                       __le64 *eof);
+                       __le64 *eof, bool is_fallocate);
 extern int SMB2_set_info(const unsigned int xid, struct cifs_tcon *tcon,
                         u64 persistent_fid, u64 volatile_fid,
                         FILE_BASIC_INFO *buf);