Lines Matching refs:mirror
43 struct nfs4_ff_layout_mirror *mirror);
183 struct nfs4_ff_layout_mirror *mirror) in ff_layout_add_mirror() argument
191 if (memcmp(&mirror->devid, &pos->devid, sizeof(pos->devid)) != 0) in ff_layout_add_mirror()
193 if (!ff_mirror_match_fh(mirror, pos)) in ff_layout_add_mirror()
200 list_add(&mirror->mirrors, &ff_layout->mirrors); in ff_layout_add_mirror()
201 mirror->layout = lo; in ff_layout_add_mirror()
203 return mirror; in ff_layout_add_mirror()
207 ff_layout_remove_mirror(struct nfs4_ff_layout_mirror *mirror) in ff_layout_remove_mirror() argument
210 if (mirror->layout == NULL) in ff_layout_remove_mirror()
212 inode = mirror->layout->plh_inode; in ff_layout_remove_mirror()
214 list_del(&mirror->mirrors); in ff_layout_remove_mirror()
216 mirror->layout = NULL; in ff_layout_remove_mirror()
221 struct nfs4_ff_layout_mirror *mirror; in ff_layout_alloc_mirror() local
223 mirror = kzalloc(sizeof(*mirror), gfp_flags); in ff_layout_alloc_mirror()
224 if (mirror != NULL) { in ff_layout_alloc_mirror()
225 spin_lock_init(&mirror->lock); in ff_layout_alloc_mirror()
226 refcount_set(&mirror->ref, 1); in ff_layout_alloc_mirror()
227 INIT_LIST_HEAD(&mirror->mirrors); in ff_layout_alloc_mirror()
229 return mirror; in ff_layout_alloc_mirror()
232 static void ff_layout_free_mirror(struct nfs4_ff_layout_mirror *mirror) in ff_layout_free_mirror() argument
236 ff_layout_remove_mirror(mirror); in ff_layout_free_mirror()
237 kfree(mirror->fh_versions); in ff_layout_free_mirror()
238 cred = rcu_access_pointer(mirror->ro_cred); in ff_layout_free_mirror()
240 cred = rcu_access_pointer(mirror->rw_cred); in ff_layout_free_mirror()
242 nfs4_ff_layout_put_deviceid(mirror->mirror_ds); in ff_layout_free_mirror()
243 kfree(mirror); in ff_layout_free_mirror()
246 static void ff_layout_put_mirror(struct nfs4_ff_layout_mirror *mirror) in ff_layout_put_mirror() argument
248 if (mirror != NULL && refcount_dec_and_test(&mirror->ref)) in ff_layout_put_mirror()
249 ff_layout_free_mirror(mirror); in ff_layout_put_mirror()
408 struct nfs4_ff_layout_mirror *mirror; in ff_layout_alloc_lseg() local
508 mirror = ff_layout_add_mirror(lh, fls->mirror_array[i]); in ff_layout_alloc_lseg()
509 if (mirror != fls->mirror_array[i]) { in ff_layout_alloc_lseg()
512 cred = xchg(&mirror->ro_cred, cred); in ff_layout_alloc_lseg()
515 cred = xchg(&mirror->rw_cred, cred); in ff_layout_alloc_lseg()
519 fls->mirror_array[i] = mirror; in ff_layout_alloc_lseg()
596 nfs4_ff_layoutstat_start_io(struct nfs4_ff_layout_mirror *mirror, in nfs4_ff_layoutstat_start_io() argument
601 struct nfs4_flexfile_layout *ffl = FF_LAYOUT_FROM_HDR(mirror->layout); in nfs4_ff_layoutstat_start_io()
604 if (!mirror->start_time) in nfs4_ff_layoutstat_start_io()
605 mirror->start_time = now; in nfs4_ff_layoutstat_start_io()
606 if (mirror->report_interval != 0) in nfs4_ff_layoutstat_start_io()
607 report_interval = (s64)mirror->report_interval * 1000LL; in nfs4_ff_layoutstat_start_io()
654 struct nfs4_ff_layout_mirror *mirror, in nfs4_ff_layout_stat_io_start_read() argument
659 spin_lock(&mirror->lock); in nfs4_ff_layout_stat_io_start_read()
660 report = nfs4_ff_layoutstat_start_io(mirror, &mirror->read_stat, now); in nfs4_ff_layout_stat_io_start_read()
661 nfs4_ff_layout_stat_io_update_requested(&mirror->read_stat, requested); in nfs4_ff_layout_stat_io_start_read()
662 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); in nfs4_ff_layout_stat_io_start_read()
663 spin_unlock(&mirror->lock); in nfs4_ff_layout_stat_io_start_read()
671 struct nfs4_ff_layout_mirror *mirror, in nfs4_ff_layout_stat_io_end_read() argument
675 spin_lock(&mirror->lock); in nfs4_ff_layout_stat_io_end_read()
676 nfs4_ff_layout_stat_io_update_completed(&mirror->read_stat, in nfs4_ff_layout_stat_io_end_read()
679 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); in nfs4_ff_layout_stat_io_end_read()
680 spin_unlock(&mirror->lock); in nfs4_ff_layout_stat_io_end_read()
685 struct nfs4_ff_layout_mirror *mirror, in nfs4_ff_layout_stat_io_start_write() argument
690 spin_lock(&mirror->lock); in nfs4_ff_layout_stat_io_start_write()
691 report = nfs4_ff_layoutstat_start_io(mirror , &mirror->write_stat, now); in nfs4_ff_layout_stat_io_start_write()
692 nfs4_ff_layout_stat_io_update_requested(&mirror->write_stat, requested); in nfs4_ff_layout_stat_io_start_write()
693 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); in nfs4_ff_layout_stat_io_start_write()
694 spin_unlock(&mirror->lock); in nfs4_ff_layout_stat_io_start_write()
702 struct nfs4_ff_layout_mirror *mirror, in nfs4_ff_layout_stat_io_end_write() argument
710 spin_lock(&mirror->lock); in nfs4_ff_layout_stat_io_end_write()
711 nfs4_ff_layout_stat_io_update_completed(&mirror->write_stat, in nfs4_ff_layout_stat_io_end_write()
713 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); in nfs4_ff_layout_stat_io_end_write()
714 spin_unlock(&mirror->lock); in nfs4_ff_layout_stat_io_end_write()
741 struct nfs4_ff_layout_mirror *mirror; in ff_layout_choose_ds_for_read() local
751 mirror = FF_LAYOUT_COMP(lseg, idx); in ff_layout_choose_ds_for_read()
752 ds = nfs4_ff_layout_prepare_ds(lseg, mirror, fail_return); in ff_layout_choose_ds_for_read()
757 nfs4_test_deviceid_unavailable(&mirror->mirror_ds->id_node)) in ff_layout_choose_ds_for_read()
839 struct nfs4_ff_layout_mirror *mirror; in ff_layout_pg_init_read() local
867 mirror = FF_LAYOUT_COMP(pgio->pg_lseg, ds_idx); in ff_layout_pg_init_read()
869 pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize; in ff_layout_pg_init_read()
893 struct nfs4_ff_layout_mirror *mirror; in ff_layout_pg_init_write() local
923 mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i); in ff_layout_pg_init_write()
924 ds = nfs4_ff_layout_prepare_ds(pgio->pg_lseg, mirror, true); in ff_layout_pg_init_write()
934 pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].wsize; in ff_layout_pg_init_write()
1233 struct nfs4_ff_layout_mirror *mirror; in ff_layout_io_track_ds_error() local
1263 mirror = FF_LAYOUT_COMP(lseg, idx); in ff_layout_io_track_ds_error()
1265 mirror, offset, length, status, opnum, in ff_layout_io_track_ds_error()
1754 struct nfs4_ff_layout_mirror *mirror; in ff_layout_read_pagelist() local
1765 mirror = FF_LAYOUT_COMP(lseg, idx); in ff_layout_read_pagelist()
1766 ds = nfs4_ff_layout_prepare_ds(lseg, mirror, false); in ff_layout_read_pagelist()
1770 ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp, in ff_layout_read_pagelist()
1775 ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, hdr->cred); in ff_layout_read_pagelist()
1779 vers = nfs4_ff_layout_ds_version(mirror); in ff_layout_read_pagelist()
1787 fh = nfs4_ff_layout_select_ds_fh(mirror); in ff_layout_read_pagelist()
1791 nfs4_ff_layout_select_ds_stateid(mirror, &hdr->args.stateid); in ff_layout_read_pagelist()
1824 struct nfs4_ff_layout_mirror *mirror; in ff_layout_write_pagelist() local
1831 mirror = FF_LAYOUT_COMP(lseg, idx); in ff_layout_write_pagelist()
1832 ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true); in ff_layout_write_pagelist()
1836 ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp, in ff_layout_write_pagelist()
1841 ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, hdr->cred); in ff_layout_write_pagelist()
1845 vers = nfs4_ff_layout_ds_version(mirror); in ff_layout_write_pagelist()
1856 fh = nfs4_ff_layout_select_ds_fh(mirror); in ff_layout_write_pagelist()
1860 nfs4_ff_layout_select_ds_stateid(mirror, &hdr->args.stateid); in ff_layout_write_pagelist()
1906 struct nfs4_ff_layout_mirror *mirror; in ff_layout_initiate_commit() local
1917 mirror = FF_LAYOUT_COMP(lseg, idx); in ff_layout_initiate_commit()
1918 ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true); in ff_layout_initiate_commit()
1922 ds_clnt = nfs4_ff_find_or_create_ds_client(mirror, ds->ds_clp, in ff_layout_initiate_commit()
1927 ds_cred = ff_layout_get_ds_cred(mirror, &lseg->pls_range, data->cred); in ff_layout_initiate_commit()
1931 vers = nfs4_ff_layout_ds_version(mirror); in ff_layout_initiate_commit()
2356 struct nfs4_ff_layout_mirror *mirror) in ff_layout_encode_ff_layoutupdate() argument
2359 struct nfs4_pnfs_ds *ds = mirror->mirror_ds->ds; in ff_layout_encode_ff_layoutupdate()
2360 struct nfs_fh *fh = &mirror->fh_versions[0]; in ff_layout_encode_ff_layoutupdate()
2372 spin_lock(&mirror->lock); in ff_layout_encode_ff_layoutupdate()
2373 ff_layout_encode_io_latency(xdr, &mirror->read_stat.io_stat); in ff_layout_encode_ff_layoutupdate()
2375 ff_layout_encode_io_latency(xdr, &mirror->write_stat.io_stat); in ff_layout_encode_ff_layoutupdate()
2376 spin_unlock(&mirror->lock); in ff_layout_encode_ff_layoutupdate()
2378 ff_layout_encode_nfstime(xdr, ktime_sub(ktime_get(), mirror->start_time)); in ff_layout_encode_ff_layoutupdate()
2402 struct nfs4_ff_layout_mirror *mirror = opaque->data; in ff_layout_free_layoutstats() local
2404 ff_layout_put_mirror(mirror); in ff_layout_free_layoutstats()
2418 struct nfs4_ff_layout_mirror *mirror; in ff_layout_mirror_prepare_stats() local
2422 list_for_each_entry(mirror, &ff_layout->mirrors, mirrors) { in ff_layout_mirror_prepare_stats()
2425 if (IS_ERR_OR_NULL(mirror->mirror_ds)) in ff_layout_mirror_prepare_stats()
2427 if (!test_and_clear_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags)) in ff_layout_mirror_prepare_stats()
2430 if (!refcount_inc_not_zero(&mirror->ref)) in ff_layout_mirror_prepare_stats()
2432 dev = &mirror->mirror_ds->id_node; in ff_layout_mirror_prepare_stats()
2436 spin_lock(&mirror->lock); in ff_layout_mirror_prepare_stats()
2437 devinfo->read_count = mirror->read_stat.io_stat.ops_completed; in ff_layout_mirror_prepare_stats()
2438 devinfo->read_bytes = mirror->read_stat.io_stat.bytes_completed; in ff_layout_mirror_prepare_stats()
2439 devinfo->write_count = mirror->write_stat.io_stat.ops_completed; in ff_layout_mirror_prepare_stats()
2440 devinfo->write_bytes = mirror->write_stat.io_stat.bytes_completed; in ff_layout_mirror_prepare_stats()
2441 spin_unlock(&mirror->lock); in ff_layout_mirror_prepare_stats()
2444 devinfo->ld_private.data = mirror; in ff_layout_mirror_prepare_stats()