@@ -715,7 +715,7 @@ nfs4_ff_layout_stat_io_end_write(struct rpc_task *task,
715715}
716716
717717static void
718- ff_layout_mark_ds_unreachable (struct pnfs_layout_segment * lseg , int idx )
718+ ff_layout_mark_ds_unreachable (struct pnfs_layout_segment * lseg , u32 idx )
719719{
720720 struct nfs4_deviceid_node * devid = FF_LAYOUT_DEVID_NODE (lseg , idx );
721721
@@ -724,7 +724,7 @@ ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, int idx)
724724}
725725
726726static void
727- ff_layout_mark_ds_reachable (struct pnfs_layout_segment * lseg , int idx )
727+ ff_layout_mark_ds_reachable (struct pnfs_layout_segment * lseg , u32 idx )
728728{
729729 struct nfs4_deviceid_node * devid = FF_LAYOUT_DEVID_NODE (lseg , idx );
730730
@@ -734,14 +734,14 @@ ff_layout_mark_ds_reachable(struct pnfs_layout_segment *lseg, int idx)
734734
735735static struct nfs4_pnfs_ds *
736736ff_layout_choose_ds_for_read (struct pnfs_layout_segment * lseg ,
737- int start_idx , int * best_idx ,
737+ u32 start_idx , u32 * best_idx ,
738738 bool check_device )
739739{
740740 struct nfs4_ff_layout_segment * fls = FF_LAYOUT_LSEG (lseg );
741741 struct nfs4_ff_layout_mirror * mirror ;
742742 struct nfs4_pnfs_ds * ds ;
743743 bool fail_return = false;
744- int idx ;
744+ u32 idx ;
745745
746746 /* mirrors are initially sorted by efficiency */
747747 for (idx = start_idx ; idx < fls -> mirror_array_cnt ; idx ++ ) {
@@ -766,21 +766,21 @@ ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg,
766766
767767static struct nfs4_pnfs_ds *
768768ff_layout_choose_any_ds_for_read (struct pnfs_layout_segment * lseg ,
769- int start_idx , int * best_idx )
769+ u32 start_idx , u32 * best_idx )
770770{
771771 return ff_layout_choose_ds_for_read (lseg , start_idx , best_idx , false);
772772}
773773
774774static struct nfs4_pnfs_ds *
775775ff_layout_choose_valid_ds_for_read (struct pnfs_layout_segment * lseg ,
776- int start_idx , int * best_idx )
776+ u32 start_idx , u32 * best_idx )
777777{
778778 return ff_layout_choose_ds_for_read (lseg , start_idx , best_idx , true);
779779}
780780
781781static struct nfs4_pnfs_ds *
782782ff_layout_choose_best_ds_for_read (struct pnfs_layout_segment * lseg ,
783- int start_idx , int * best_idx )
783+ u32 start_idx , u32 * best_idx )
784784{
785785 struct nfs4_pnfs_ds * ds ;
786786
@@ -791,7 +791,8 @@ ff_layout_choose_best_ds_for_read(struct pnfs_layout_segment *lseg,
791791}
792792
793793static struct nfs4_pnfs_ds *
794- ff_layout_get_ds_for_read (struct nfs_pageio_descriptor * pgio , int * best_idx )
794+ ff_layout_get_ds_for_read (struct nfs_pageio_descriptor * pgio ,
795+ u32 * best_idx )
795796{
796797 struct pnfs_layout_segment * lseg = pgio -> pg_lseg ;
797798 struct nfs4_pnfs_ds * ds ;
@@ -837,7 +838,7 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
837838 struct nfs_pgio_mirror * pgm ;
838839 struct nfs4_ff_layout_mirror * mirror ;
839840 struct nfs4_pnfs_ds * ds ;
840- int ds_idx ;
841+ u32 ds_idx , i ;
841842
842843retry :
843844 ff_layout_pg_check_layout (pgio , req );
@@ -863,14 +864,14 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
863864 goto retry ;
864865 }
865866
866- mirror = FF_LAYOUT_COMP (pgio -> pg_lseg , ds_idx );
867+ for (i = 0 ; i < pgio -> pg_mirror_count ; i ++ ) {
868+ mirror = FF_LAYOUT_COMP (pgio -> pg_lseg , i );
869+ pgm = & pgio -> pg_mirrors [i ];
870+ pgm -> pg_bsize = mirror -> mirror_ds -> ds_versions [0 ].rsize ;
871+ }
867872
868873 pgio -> pg_mirror_idx = ds_idx ;
869874
870- /* read always uses only one mirror - idx 0 for pgio layer */
871- pgm = & pgio -> pg_mirrors [0 ];
872- pgm -> pg_bsize = mirror -> mirror_ds -> ds_versions [0 ].rsize ;
873-
874875 if (NFS_SERVER (pgio -> pg_inode )-> flags &
875876 (NFS_MOUNT_SOFT |NFS_MOUNT_SOFTERR ))
876877 pgio -> pg_maxretrans = io_maxretrans ;
@@ -894,7 +895,7 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
894895 struct nfs4_ff_layout_mirror * mirror ;
895896 struct nfs_pgio_mirror * pgm ;
896897 struct nfs4_pnfs_ds * ds ;
897- int i ;
898+ u32 i ;
898899
899900retry :
900901 ff_layout_pg_check_layout (pgio , req );
@@ -1038,7 +1039,7 @@ static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs)
10381039static void ff_layout_resend_pnfs_read (struct nfs_pgio_header * hdr )
10391040{
10401041 u32 idx = hdr -> pgio_mirror_idx + 1 ;
1041- int new_idx = 0 ;
1042+ u32 new_idx = 0 ;
10421043
10431044 if (ff_layout_choose_any_ds_for_read (hdr -> lseg , idx + 1 , & new_idx ))
10441045 ff_layout_send_layouterror (hdr -> lseg );
@@ -1075,7 +1076,7 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,
10751076 struct nfs4_state * state ,
10761077 struct nfs_client * clp ,
10771078 struct pnfs_layout_segment * lseg ,
1078- int idx )
1079+ u32 idx )
10791080{
10801081 struct pnfs_layout_hdr * lo = lseg -> pls_layout ;
10811082 struct inode * inode = lo -> plh_inode ;
@@ -1149,7 +1150,7 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,
11491150/* Retry all errors through either pNFS or MDS except for -EJUKEBOX */
11501151static int ff_layout_async_handle_error_v3 (struct rpc_task * task ,
11511152 struct pnfs_layout_segment * lseg ,
1152- int idx )
1153+ u32 idx )
11531154{
11541155 struct nfs4_deviceid_node * devid = FF_LAYOUT_DEVID_NODE (lseg , idx );
11551156
@@ -1184,7 +1185,7 @@ static int ff_layout_async_handle_error(struct rpc_task *task,
11841185 struct nfs4_state * state ,
11851186 struct nfs_client * clp ,
11861187 struct pnfs_layout_segment * lseg ,
1187- int idx )
1188+ u32 idx )
11881189{
11891190 int vers = clp -> cl_nfs_mod -> rpc_vers -> number ;
11901191
@@ -1211,7 +1212,7 @@ static int ff_layout_async_handle_error(struct rpc_task *task,
12111212}
12121213
12131214static void ff_layout_io_track_ds_error (struct pnfs_layout_segment * lseg ,
1214- int idx , u64 offset , u64 length ,
1215+ u32 idx , u64 offset , u64 length ,
12151216 u32 * op_status , int opnum , int error )
12161217{
12171218 struct nfs4_ff_layout_mirror * mirror ;
@@ -1809,7 +1810,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
18091810 loff_t offset = hdr -> args .offset ;
18101811 int vers ;
18111812 struct nfs_fh * fh ;
1812- int idx = hdr -> pgio_mirror_idx ;
1813+ u32 idx = hdr -> pgio_mirror_idx ;
18131814
18141815 mirror = FF_LAYOUT_COMP (lseg , idx );
18151816 ds = nfs4_ff_layout_prepare_ds (lseg , mirror , true);
0 commit comments