@@ -807,7 +807,7 @@ static ssize_t gfs2_file_direct_read(struct kiocb *iocb, struct iov_iter *to,
807
807
struct file * file = iocb -> ki_filp ;
808
808
struct gfs2_inode * ip = GFS2_I (file -> f_mapping -> host );
809
809
size_t prev_count = 0 , window_size = 0 ;
810
- size_t written = 0 ;
810
+ size_t read = 0 ;
811
811
ssize_t ret ;
812
812
813
813
/*
@@ -839,11 +839,11 @@ static ssize_t gfs2_file_direct_read(struct kiocb *iocb, struct iov_iter *to,
839
839
pagefault_disable ();
840
840
to -> nofault = true;
841
841
ret = iomap_dio_rw (iocb , to , & gfs2_iomap_ops , NULL ,
842
- IOMAP_DIO_PARTIAL , written );
842
+ IOMAP_DIO_PARTIAL , read );
843
843
to -> nofault = false;
844
844
pagefault_enable ();
845
845
if (ret > 0 )
846
- written = ret ;
846
+ read = ret ;
847
847
848
848
if (should_fault_in_pages (ret , to , & prev_count , & window_size )) {
849
849
size_t leftover ;
@@ -863,7 +863,7 @@ static ssize_t gfs2_file_direct_read(struct kiocb *iocb, struct iov_iter *to,
863
863
gfs2_holder_uninit (gh );
864
864
if (ret < 0 )
865
865
return ret ;
866
- return written ;
866
+ return read ;
867
867
}
868
868
869
869
static ssize_t gfs2_file_direct_write (struct kiocb * iocb , struct iov_iter * from ,
@@ -873,7 +873,7 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from,
873
873
struct inode * inode = file -> f_mapping -> host ;
874
874
struct gfs2_inode * ip = GFS2_I (inode );
875
875
size_t prev_count = 0 , window_size = 0 ;
876
- size_t read = 0 ;
876
+ size_t written = 0 ;
877
877
ssize_t ret ;
878
878
879
879
/*
@@ -906,13 +906,13 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from,
906
906
907
907
from -> nofault = true;
908
908
ret = iomap_dio_rw (iocb , from , & gfs2_iomap_ops , NULL ,
909
- IOMAP_DIO_PARTIAL , read );
909
+ IOMAP_DIO_PARTIAL , written );
910
910
from -> nofault = false;
911
911
912
912
if (ret == - ENOTBLK )
913
913
ret = 0 ;
914
914
if (ret > 0 )
915
- read = ret ;
915
+ written = ret ;
916
916
917
917
if (should_fault_in_pages (ret , from , & prev_count , & window_size )) {
918
918
size_t leftover ;
@@ -933,15 +933,15 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from,
933
933
gfs2_holder_uninit (gh );
934
934
if (ret < 0 )
935
935
return ret ;
936
- return read ;
936
+ return written ;
937
937
}
938
938
939
939
static ssize_t gfs2_file_read_iter (struct kiocb * iocb , struct iov_iter * to )
940
940
{
941
941
struct gfs2_inode * ip ;
942
942
struct gfs2_holder gh ;
943
943
size_t prev_count = 0 , window_size = 0 ;
944
- size_t written = 0 ;
944
+ size_t read = 0 ;
945
945
ssize_t ret ;
946
946
947
947
/*
@@ -962,7 +962,7 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
962
962
if (ret >= 0 ) {
963
963
if (!iov_iter_count (to ))
964
964
return ret ;
965
- written = ret ;
965
+ read = ret ;
966
966
} else if (ret != - EFAULT ) {
967
967
if (ret != - EAGAIN )
968
968
return ret ;
@@ -980,7 +980,7 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
980
980
ret = generic_file_read_iter (iocb , to );
981
981
pagefault_enable ();
982
982
if (ret > 0 )
983
- written += ret ;
983
+ read += ret ;
984
984
985
985
if (should_fault_in_pages (ret , to , & prev_count , & window_size )) {
986
986
size_t leftover ;
@@ -998,7 +998,7 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
998
998
gfs2_glock_dq (& gh );
999
999
out_uninit :
1000
1000
gfs2_holder_uninit (& gh );
1001
- return written ? written : ret ;
1001
+ return read ? read : ret ;
1002
1002
}
1003
1003
1004
1004
static ssize_t gfs2_file_buffered_write (struct kiocb * iocb ,
@@ -1012,7 +1012,7 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,
1012
1012
struct gfs2_holder * statfs_gh = NULL ;
1013
1013
size_t prev_count = 0 , window_size = 0 ;
1014
1014
size_t orig_count = iov_iter_count (from );
1015
- size_t read = 0 ;
1015
+ size_t written = 0 ;
1016
1016
ssize_t ret ;
1017
1017
1018
1018
/*
@@ -1050,13 +1050,13 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,
1050
1050
current -> backing_dev_info = NULL ;
1051
1051
if (ret > 0 ) {
1052
1052
iocb -> ki_pos += ret ;
1053
- read += ret ;
1053
+ written += ret ;
1054
1054
}
1055
1055
1056
1056
if (inode == sdp -> sd_rindex )
1057
1057
gfs2_glock_dq_uninit (statfs_gh );
1058
1058
1059
- from -> count = orig_count - read ;
1059
+ from -> count = orig_count - written ;
1060
1060
if (should_fault_in_pages (ret , from , & prev_count , & window_size )) {
1061
1061
size_t leftover ;
1062
1062
@@ -1077,8 +1077,8 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,
1077
1077
gfs2_holder_uninit (gh );
1078
1078
if (statfs_gh )
1079
1079
kfree (statfs_gh );
1080
- from -> count = orig_count - read ;
1081
- return read ? read : ret ;
1080
+ from -> count = orig_count - written ;
1081
+ return written ? written : ret ;
1082
1082
}
1083
1083
1084
1084
/**
0 commit comments