Lines Matching refs:fls
258 static void ff_layout_free_mirror_array(struct nfs4_ff_layout_segment *fls) in ff_layout_free_mirror_array() argument
262 for (i = 0; i < fls->mirror_array_cnt; i++) in ff_layout_free_mirror_array()
263 ff_layout_put_mirror(fls->mirror_array[i]); in ff_layout_free_mirror_array()
266 static void _ff_layout_free_lseg(struct nfs4_ff_layout_segment *fls) in _ff_layout_free_lseg() argument
268 if (fls) { in _ff_layout_free_lseg()
269 ff_layout_free_mirror_array(fls); in _ff_layout_free_lseg()
270 kfree(fls); in _ff_layout_free_lseg()
352 static void ff_layout_sort_mirrors(struct nfs4_ff_layout_segment *fls) in ff_layout_sort_mirrors() argument
356 for (i = 0; i < fls->mirror_array_cnt - 1; i++) { in ff_layout_sort_mirrors()
357 for (j = i + 1; j < fls->mirror_array_cnt; j++) in ff_layout_sort_mirrors()
358 if (fls->mirror_array[i]->efficiency < in ff_layout_sort_mirrors()
359 fls->mirror_array[j]->efficiency) in ff_layout_sort_mirrors()
360 swap(fls->mirror_array[i], in ff_layout_sort_mirrors()
361 fls->mirror_array[j]); in ff_layout_sort_mirrors()
371 struct nfs4_ff_layout_segment *fls = NULL; in ff_layout_alloc_lseg() local
405 fls = kzalloc(struct_size(fls, mirror_array, mirror_array_cnt), in ff_layout_alloc_lseg()
407 if (!fls) in ff_layout_alloc_lseg()
410 fls->mirror_array_cnt = mirror_array_cnt; in ff_layout_alloc_lseg()
411 fls->stripe_unit = stripe_unit; in ff_layout_alloc_lseg()
413 for (i = 0; i < fls->mirror_array_cnt; i++) { in ff_layout_alloc_lseg()
432 fls->mirror_array[i] = ff_layout_alloc_mirror(gfp_flags); in ff_layout_alloc_lseg()
433 if (fls->mirror_array[i] == NULL) { in ff_layout_alloc_lseg()
438 fls->mirror_array[i]->ds_count = ds_count; in ff_layout_alloc_lseg()
441 rc = decode_deviceid(&stream, &fls->mirror_array[i]->devid); in ff_layout_alloc_lseg()
450 fls->mirror_array[i]->efficiency = be32_to_cpup(p); in ff_layout_alloc_lseg()
453 rc = decode_pnfs_stateid(&stream, &fls->mirror_array[i]->stateid); in ff_layout_alloc_lseg()
464 fls->mirror_array[i]->fh_versions = in ff_layout_alloc_lseg()
467 if (fls->mirror_array[i]->fh_versions == NULL) { in ff_layout_alloc_lseg()
474 &fls->mirror_array[i]->fh_versions[j]); in ff_layout_alloc_lseg()
479 fls->mirror_array[i]->fh_versions_cnt = fh_count; in ff_layout_alloc_lseg()
510 rcu_assign_pointer(fls->mirror_array[i]->ro_cred, cred); in ff_layout_alloc_lseg()
512 rcu_assign_pointer(fls->mirror_array[i]->rw_cred, cred); in ff_layout_alloc_lseg()
514 mirror = ff_layout_add_mirror(lh, fls->mirror_array[i]); in ff_layout_alloc_lseg()
515 if (mirror != fls->mirror_array[i]) { in ff_layout_alloc_lseg()
519 rcu_assign_pointer(fls->mirror_array[i]->ro_cred, cred); in ff_layout_alloc_lseg()
522 rcu_assign_pointer(fls->mirror_array[i]->rw_cred, cred); in ff_layout_alloc_lseg()
524 ff_layout_free_mirror(fls->mirror_array[i]); in ff_layout_alloc_lseg()
525 fls->mirror_array[i] = mirror; in ff_layout_alloc_lseg()
537 fls->flags = be32_to_cpup(p); in ff_layout_alloc_lseg()
542 for (i=0; i < fls->mirror_array_cnt; i++) in ff_layout_alloc_lseg()
543 fls->mirror_array[i]->report_interval = be32_to_cpup(p); in ff_layout_alloc_lseg()
546 ff_layout_sort_mirrors(fls); in ff_layout_alloc_lseg()
547 ret = &fls->generic_hdr; in ff_layout_alloc_lseg()
553 _ff_layout_free_lseg(fls); in ff_layout_alloc_lseg()
562 struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg); in ff_layout_free_lseg() local
576 _ff_layout_free_lseg(fls); in ff_layout_free_lseg()
746 struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg); in ff_layout_choose_ds_for_read() local
752 for (idx = start_idx; idx < fls->mirror_array_cnt; idx++) { in ff_layout_choose_ds_for_read()