@@ -1935,7 +1935,6 @@ static int
1935
1935
smb2_set_file_size (const unsigned int xid , struct cifs_tcon * tcon ,
1936
1936
struct cifsFileInfo * cfile , __u64 size , bool set_alloc )
1937
1937
{
1938
- __le64 eof = cpu_to_le64 (size );
1939
1938
struct inode * inode ;
1940
1939
1941
1940
/*
@@ -1952,7 +1951,7 @@ smb2_set_file_size(const unsigned int xid, struct cifs_tcon *tcon,
1952
1951
}
1953
1952
1954
1953
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 );
1956
1955
}
1957
1956
1958
1957
static int
@@ -3197,7 +3196,6 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
3197
3196
unsigned long long new_size ;
3198
3197
long rc ;
3199
3198
unsigned int xid ;
3200
- __le64 eof ;
3201
3199
3202
3200
xid = get_xid ();
3203
3201
@@ -3227,9 +3225,8 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon,
3227
3225
*/
3228
3226
new_size = offset + len ;
3229
3227
if (keep_size == false && (unsigned long long )i_size_read (inode ) < new_size ) {
3230
- eof = cpu_to_le64 (new_size );
3231
3228
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 );
3233
3230
if (rc >= 0 ) {
3234
3231
truncate_setsize (inode , new_size );
3235
3232
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,
3422
3419
struct cifsFileInfo * cfile = file -> private_data ;
3423
3420
long rc = - EOPNOTSUPP ;
3424
3421
unsigned int xid ;
3425
- __le64 eof ;
3422
+ loff_t new_eof ;
3426
3423
3427
3424
xid = get_xid ();
3428
3425
@@ -3451,14 +3448,14 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon,
3451
3448
if (cifsi -> cifsAttrs & FILE_ATTRIBUTE_SPARSE_FILE )
3452
3449
smb2_set_sparse (xid , tcon , cfile , inode , false);
3453
3450
3454
- eof = cpu_to_le64 ( off + len ) ;
3451
+ new_eof = off + len ;
3455
3452
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 );
3457
3454
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 );
3460
3457
cifs_truncate_page (inode -> i_mapping , inode -> i_size );
3461
- truncate_setsize (inode , off + len );
3458
+ truncate_setsize (inode , new_eof );
3462
3459
}
3463
3460
goto out ;
3464
3461
}
@@ -3549,8 +3546,7 @@ static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon,
3549
3546
struct inode * inode = file_inode (file );
3550
3547
struct cifsFileInfo * cfile = file -> private_data ;
3551
3548
struct cifsInodeInfo * cifsi = CIFS_I (inode );
3552
- __le64 eof ;
3553
- loff_t old_eof ;
3549
+ loff_t old_eof , new_eof ;
3554
3550
3555
3551
xid = get_xid ();
3556
3552
@@ -3575,9 +3571,9 @@ static long smb3_collapse_range(struct file *file, struct cifs_tcon *tcon,
3575
3571
if (rc < 0 )
3576
3572
goto out_2 ;
3577
3573
3578
- eof = cpu_to_le64 ( old_eof - len ) ;
3574
+ new_eof = old_eof - len ;
3579
3575
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 );
3581
3577
if (rc < 0 )
3582
3578
goto out_2 ;
3583
3579
@@ -3601,8 +3597,7 @@ static long smb3_insert_range(struct file *file, struct cifs_tcon *tcon,
3601
3597
unsigned int xid ;
3602
3598
struct cifsFileInfo * cfile = file -> private_data ;
3603
3599
struct inode * inode = file_inode (file );
3604
- __le64 eof ;
3605
- __u64 count , old_eof ;
3600
+ __u64 count , old_eof , new_eof ;
3606
3601
3607
3602
xid = get_xid ();
3608
3603
@@ -3615,20 +3610,20 @@ static long smb3_insert_range(struct file *file, struct cifs_tcon *tcon,
3615
3610
}
3616
3611
3617
3612
count = old_eof - off ;
3618
- eof = cpu_to_le64 ( old_eof + len ) ;
3613
+ new_eof = old_eof + len ;
3619
3614
3620
3615
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 );
3622
3617
if (rc < 0 )
3623
3618
goto out_2 ;
3624
3619
truncate_pagecache_range (inode , off , old_eof );
3625
3620
3626
3621
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 );
3628
3623
if (rc < 0 )
3629
3624
goto out_2 ;
3630
3625
3631
- truncate_setsize (inode , old_eof + len );
3626
+ truncate_setsize (inode , new_eof );
3632
3627
fscache_resize_cookie (cifs_inode_cookie (inode ), i_size_read (inode ));
3633
3628
3634
3629
rc = smb2_copychunk_range (xid , cfile , cfile , off , count , off + len );
0 commit comments