@@ -781,39 +781,39 @@ static int gfs2_fsync(struct file *file, loff_t start, loff_t end,
781
781
return ret ? ret : ret1 ;
782
782
}
783
783
784
- static ssize_t gfs2_file_direct_read (struct kiocb * iocb , struct iov_iter * to )
784
+ static ssize_t gfs2_file_direct_read (struct kiocb * iocb , struct iov_iter * to ,
785
+ struct gfs2_holder * gh )
785
786
{
786
787
struct file * file = iocb -> ki_filp ;
787
788
struct gfs2_inode * ip = GFS2_I (file -> f_mapping -> host );
788
789
size_t count = iov_iter_count (to );
789
- struct gfs2_holder gh ;
790
790
ssize_t ret ;
791
791
792
792
if (!count )
793
793
return 0 ; /* skip atime */
794
794
795
- gfs2_holder_init (ip -> i_gl , LM_ST_DEFERRED , 0 , & gh );
796
- ret = gfs2_glock_nq (& gh );
795
+ gfs2_holder_init (ip -> i_gl , LM_ST_DEFERRED , 0 , gh );
796
+ ret = gfs2_glock_nq (gh );
797
797
if (ret )
798
798
goto out_uninit ;
799
799
800
800
ret = iomap_dio_rw (iocb , to , & gfs2_iomap_ops , NULL ,
801
801
is_sync_kiocb (iocb ));
802
802
803
- gfs2_glock_dq (& gh );
803
+ gfs2_glock_dq (gh );
804
804
out_uninit :
805
- gfs2_holder_uninit (& gh );
805
+ gfs2_holder_uninit (gh );
806
806
return ret ;
807
807
}
808
808
809
- static ssize_t gfs2_file_direct_write (struct kiocb * iocb , struct iov_iter * from )
809
+ static ssize_t gfs2_file_direct_write (struct kiocb * iocb , struct iov_iter * from ,
810
+ struct gfs2_holder * gh )
810
811
{
811
812
struct file * file = iocb -> ki_filp ;
812
813
struct inode * inode = file -> f_mapping -> host ;
813
814
struct gfs2_inode * ip = GFS2_I (inode );
814
815
size_t len = iov_iter_count (from );
815
816
loff_t offset = iocb -> ki_pos ;
816
- struct gfs2_holder gh ;
817
817
ssize_t ret ;
818
818
819
819
/*
@@ -824,8 +824,8 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from)
824
824
* unfortunately, have the option of only flushing a range like the
825
825
* VFS does.
826
826
*/
827
- gfs2_holder_init (ip -> i_gl , LM_ST_DEFERRED , 0 , & gh );
828
- ret = gfs2_glock_nq (& gh );
827
+ gfs2_holder_init (ip -> i_gl , LM_ST_DEFERRED , 0 , gh );
828
+ ret = gfs2_glock_nq (gh );
829
829
if (ret )
830
830
goto out_uninit ;
831
831
@@ -837,9 +837,9 @@ static ssize_t gfs2_file_direct_write(struct kiocb *iocb, struct iov_iter *from)
837
837
is_sync_kiocb (iocb ));
838
838
839
839
out :
840
- gfs2_glock_dq (& gh );
840
+ gfs2_glock_dq (gh );
841
841
out_uninit :
842
- gfs2_holder_uninit (& gh );
842
+ gfs2_holder_uninit (gh );
843
843
return ret ;
844
844
}
845
845
@@ -851,7 +851,7 @@ static ssize_t gfs2_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
851
851
ssize_t ret ;
852
852
853
853
if (iocb -> ki_flags & IOCB_DIRECT ) {
854
- ret = gfs2_file_direct_read (iocb , to );
854
+ ret = gfs2_file_direct_read (iocb , to , & gh );
855
855
if (likely (ret != - ENOTBLK ))
856
856
return ret ;
857
857
iocb -> ki_flags &= ~IOCB_DIRECT ;
@@ -900,13 +900,12 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
900
900
struct file * file = iocb -> ki_filp ;
901
901
struct inode * inode = file_inode (file );
902
902
struct gfs2_inode * ip = GFS2_I (inode );
903
+ struct gfs2_holder gh ;
903
904
ssize_t ret ;
904
905
905
906
gfs2_size_hint (file , iocb -> ki_pos , iov_iter_count (from ));
906
907
907
908
if (iocb -> ki_flags & IOCB_APPEND ) {
908
- struct gfs2_holder gh ;
909
-
910
909
ret = gfs2_glock_nq_init (ip -> i_gl , LM_ST_SHARED , 0 , & gh );
911
910
if (ret )
912
911
return ret ;
@@ -930,7 +929,7 @@ static ssize_t gfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
930
929
struct address_space * mapping = file -> f_mapping ;
931
930
ssize_t buffered , ret2 ;
932
931
933
- ret = gfs2_file_direct_write (iocb , from );
932
+ ret = gfs2_file_direct_write (iocb , from , & gh );
934
933
if (ret < 0 || !iov_iter_count (from ))
935
934
goto out_unlock ;
936
935
0 commit comments