Skip to content

Commit b9df46d

Browse files
author
Trond Myklebust
committed
pNFS/flexfiles: Be consistent about mirror index types
A mirror index is always of type u32. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent ee15c7b commit b9df46d

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

‎fs/nfs/flexfilelayout/flexfilelayout.c‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ nfs4_ff_layout_stat_io_end_write(struct rpc_task *task,
715715
}
716716

717717
static 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

726726
static 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

735735
static struct nfs4_pnfs_ds *
736736
ff_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

767767
static struct nfs4_pnfs_ds *
768768
ff_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

774774
static struct nfs4_pnfs_ds *
775775
ff_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

781781
static struct nfs4_pnfs_ds *
782782
ff_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

793793
static 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,8 +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 i;
841+
u32 ds_idx, i;
842842

843843
retry:
844844
ff_layout_pg_check_layout(pgio, req);
@@ -895,7 +895,7 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
895895
struct nfs4_ff_layout_mirror *mirror;
896896
struct nfs_pgio_mirror *pgm;
897897
struct nfs4_pnfs_ds *ds;
898-
int i;
898+
u32 i;
899899

900900
retry:
901901
ff_layout_pg_check_layout(pgio, req);
@@ -1039,7 +1039,7 @@ static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs)
10391039
static void ff_layout_resend_pnfs_read(struct nfs_pgio_header *hdr)
10401040
{
10411041
u32 idx = hdr->pgio_mirror_idx + 1;
1042-
int new_idx = 0;
1042+
u32 new_idx = 0;
10431043

10441044
if (ff_layout_choose_any_ds_for_read(hdr->lseg, idx + 1, &new_idx))
10451045
ff_layout_send_layouterror(hdr->lseg);
@@ -1076,7 +1076,7 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,
10761076
struct nfs4_state *state,
10771077
struct nfs_client *clp,
10781078
struct pnfs_layout_segment *lseg,
1079-
int idx)
1079+
u32 idx)
10801080
{
10811081
struct pnfs_layout_hdr *lo = lseg->pls_layout;
10821082
struct inode *inode = lo->plh_inode;
@@ -1150,7 +1150,7 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,
11501150
/* Retry all errors through either pNFS or MDS except for -EJUKEBOX */
11511151
static int ff_layout_async_handle_error_v3(struct rpc_task *task,
11521152
struct pnfs_layout_segment *lseg,
1153-
int idx)
1153+
u32 idx)
11541154
{
11551155
struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx);
11561156

@@ -1185,7 +1185,7 @@ static int ff_layout_async_handle_error(struct rpc_task *task,
11851185
struct nfs4_state *state,
11861186
struct nfs_client *clp,
11871187
struct pnfs_layout_segment *lseg,
1188-
int idx)
1188+
u32 idx)
11891189
{
11901190
int vers = clp->cl_nfs_mod->rpc_vers->number;
11911191

@@ -1212,7 +1212,7 @@ static int ff_layout_async_handle_error(struct rpc_task *task,
12121212
}
12131213

12141214
static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,
1215-
int idx, u64 offset, u64 length,
1215+
u32 idx, u64 offset, u64 length,
12161216
u32 *op_status, int opnum, int error)
12171217
{
12181218
struct nfs4_ff_layout_mirror *mirror;
@@ -1810,7 +1810,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
18101810
loff_t offset = hdr->args.offset;
18111811
int vers;
18121812
struct nfs_fh *fh;
1813-
int idx = hdr->pgio_mirror_idx;
1813+
u32 idx = hdr->pgio_mirror_idx;
18141814

18151815
mirror = FF_LAYOUT_COMP(lseg, idx);
18161816
ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true);

‎include/linux/nfs_xdr.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1611,8 +1611,8 @@ struct nfs_pgio_header {
16111611
__u64 mds_offset; /* Filelayout dense stripe */
16121612
struct nfs_page_array page_array;
16131613
struct nfs_client *ds_clp; /* pNFS data server */
1614-
int ds_commit_idx; /* ds index if ds_clp is set */
1615-
int pgio_mirror_idx;/* mirror index in pgio layer */
1614+
u32 ds_commit_idx; /* ds index if ds_clp is set */
1615+
u32 pgio_mirror_idx;/* mirror index in pgio layer */
16161616
};
16171617

16181618
struct nfs_mds_commit_info {

0 commit comments

Comments
 (0)