@@ -1935,7 +1935,6 @@ static int
19351935smb2_set_file_size (const unsigned int xid , struct cifs_tcon * tcon ,
19361936 struct cifsFileInfo * cfile , __u64 size , bool set_alloc )
19371937{
1938- __le64 eof = cpu_to_le64 (size );
19391938 struct inode * inode ;
19401939
19411940 /*
@@ -1952,7 +1951,7 @@ smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon,
19521951 }
19531952
19541953 return SMB2_set_eof (xid , tcon , cfile -> fid .persistent_fid ,
1955- cfile -> fid .volatile_fid , cfile -> pid , & eof );
1954+ cfile -> fid .volatile_fid , cfile -> pid , size );
19561955}
19571956
19581957static int
@@ -3197,7 +3196,6 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
31973196 unsigned long long new_size ;
31983197 long rc ;
31993198 unsigned int xid ;
3200- __le64 eof ;
32013199
32023200 xid = get_xid ();
32033201
@@ -3227,9 +3225,8 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
32273225 */
32283226 new_size = offset + len ;
32293227 if (keep_size == false && (unsigned long long )i_size_read (inode ) < new_size ) {
3230- eof = cpu_to_le64 (new_size );
32313228 rc = SMB2_set_eof (xid , tcon , cfile -> fid .persistent_fid ,
3232- cfile -> fid .volatile_fid , cfile -> pid , & eof );
3229+ cfile -> fid .volatile_fid , cfile -> pid , new_size );
32333230 if (rc >= 0 ) {
32343231 truncate_setsize (inode , new_size );
32353232 fscache_resize_cookie (cifs_inode_cookie (inode ), new_size );
@@ -3422,7 +3419,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
34223419 struct cifsFileInfo * cfile = file -> private_data ;
34233420 long rc = - EOPNOTSUPP ;
34243421 unsigned int xid ;
3425- __le64 eof ;
3422+ loff_t new_eof ;
34263423
34273424 xid = get_xid ();
34283425
@@ -3451,14 +3448,14 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
34513448 if (cifsi -> cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE )
34523449 smb2_set_sparse (xid , tcon , cfile , inode , false);
34533450
3454- eof = cpu_to_le64 ( off + len ) ;
3451+ new_eof = off + len ;
34553452 rc = SMB2_set_eof (xid , tcon , cfile -> fid .persistent_fid ,
3456- cfile -> fid .volatile_fid , cfile -> pid , & eof );
3453+ cfile -> fid .volatile_fid , cfile -> pid , new_eof );
34573454 if (rc == 0 ) {
3458- cifsi -> server_eof = off + len ;
3459- cifs_setsize (inode , off + len );
3455+ cifsi -> server_eof = new_eof ;
3456+ cifs_setsize (inode , new_eof );
34603457 cifs_truncate_page (inode -> i_mapping , inode -> i_size );
3461- truncate_setsize (inode , off + len );
3458+ truncate_setsize (inode , new_eof );
34623459 }
34633460 goto out ;
34643461 }
@@ -3549,8 +3546,7 @@ static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon,
35493546 struct inode * inode = file_inode (file );
35503547 struct cifsFileInfo * cfile = file -> private_data ;
35513548 struct cifsInodeInfo * cifsi = CIFS_I (inode );
3552- __le64 eof ;
3553- loff_t old_eof ;
3549+ loff_t old_eof , new_eof ;
35543550
35553551 xid = get_xid ();
35563552
@@ -3575,9 +3571,9 @@ static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon,
35753571 if (rc < 0 )
35763572 goto out_2 ;
35773573
3578- eof = cpu_to_le64 ( old_eof - len ) ;
3574+ new_eof = old_eof - len ;
35793575 rc = SMB2_set_eof (xid , tcon , cfile -> fid .persistent_fid ,
3580- cfile -> fid .volatile_fid , cfile -> pid , & eof );
3576+ cfile -> fid .volatile_fid , cfile -> pid , new_eof );
35813577 if (rc < 0 )
35823578 goto out_2 ;
35833579
@@ -3601,8 +3597,7 @@ static long smb3_insert_range(struct file *file, struct cifs_tcon *tcon,
36013597 unsigned int xid ;
36023598 struct cifsFileInfo * cfile = file -> private_data ;
36033599 struct inode * inode = file_inode (file );
3604- __le64 eof ;
3605- __u64 count , old_eof ;
3600+ __u64 count , old_eof , new_eof ;
36063601
36073602 xid = get_xid ();
36083603
@@ -3615,20 +3610,20 @@ static long smb3_insert_range(struct file *file, struct cifs_tcon *tcon,
36153610 }
36163611
36173612 count = old_eof - off ;
3618- eof = cpu_to_le64 ( old_eof + len ) ;
3613+ new_eof = old_eof + len ;
36193614
36203615 filemap_invalidate_lock (inode -> i_mapping );
3621- rc = filemap_write_and_wait_range (inode -> i_mapping , off , old_eof + len - 1 );
3616+ rc = filemap_write_and_wait_range (inode -> i_mapping , off , new_eof - 1 );
36223617 if (rc < 0 )
36233618 goto out_2 ;
36243619 truncate_pagecache_range (inode , off , old_eof );
36253620
36263621 rc = SMB2_set_eof (xid , tcon , cfile -> fid .persistent_fid ,
3627- cfile -> fid .volatile_fid , cfile -> pid , & eof );
3622+ cfile -> fid .volatile_fid , cfile -> pid , new_eof );
36283623 if (rc < 0 )
36293624 goto out_2 ;
36303625
3631- truncate_setsize (inode , old_eof + len );
3626+ truncate_setsize (inode , new_eof );
36323627 fscache_resize_cookie (cifs_inode_cookie (inode ), i_size_read (inode ));
36333628
36343629 rc = smb2_copychunk_range (xid , cfile , cfile , off , count , off + len );
0 commit comments