Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

NFSv4/flexfiles: Update layout stats & error paths for striped layouts

Updates the layout stats logic to be stripe aware. Read and write
stats are accumulated on a per DS stripe basis. Also updates error
paths to use dss_id where appropraite.

Limitations:

1. The layout stats structure is still statically sized to 4 and there
is no deduplication logic for deviceids that may appear more than once
in a striped layout.

Signed-off-by: Jonathan Curley <jcurley@purestorage.com>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>

authored by

Jonathan Curley and committed by
Anna Schumaker
8a8e0f55 06d157d6

+208 -102
+208 -102
fs/nfs/flexfilelayout/flexfilelayout.c
··· 47 47 int dev_limit, enum nfs4_ff_op_type type); 48 48 static void ff_layout_encode_ff_layoutupdate(struct xdr_stream *xdr, 49 49 const struct nfs42_layoutstat_devinfo *devinfo, 50 - struct nfs4_ff_layout_mirror *mirror); 50 + struct nfs4_ff_layout_ds_stripe *dss_info); 51 51 52 52 static struct pnfs_layout_hdr * 53 53 ff_layout_alloc_layout_hdr(struct inode *inode, gfp_t gfp_flags) ··· 649 649 650 650 static bool 651 651 nfs4_ff_layoutstat_start_io(struct nfs4_ff_layout_mirror *mirror, 652 + u32 dss_id, 652 653 struct nfs4_ff_layoutstat *layoutstat, 653 654 ktime_t now) 654 655 { ··· 657 656 struct nfs4_flexfile_layout *ffl = FF_LAYOUT_FROM_HDR(mirror->layout); 658 657 659 658 nfs4_ff_start_busy_timer(&layoutstat->busy_timer, now); 660 - if (!mirror->dss[0].start_time) 661 - mirror->dss[0].start_time = now; 659 + if (!mirror->dss[dss_id].start_time) 660 + mirror->dss[dss_id].start_time = now; 662 661 if (mirror->report_interval != 0) 663 662 report_interval = (s64)mirror->report_interval * 1000LL; 664 663 else if (layoutstats_timer != 0) ··· 708 707 static void 709 708 nfs4_ff_layout_stat_io_start_read(struct inode *inode, 710 709 struct nfs4_ff_layout_mirror *mirror, 710 + u32 dss_id, 711 711 __u64 requested, ktime_t now) 712 712 { 713 713 bool report; 714 714 715 715 spin_lock(&mirror->lock); 716 - report = nfs4_ff_layoutstat_start_io(mirror, &mirror->dss[0].read_stat, now); 717 - nfs4_ff_layout_stat_io_update_requested(&mirror->dss[0].read_stat, requested); 716 + report = nfs4_ff_layoutstat_start_io( 717 + mirror, dss_id, &mirror->dss[dss_id].read_stat, now); 718 + nfs4_ff_layout_stat_io_update_requested( 719 + &mirror->dss[dss_id].read_stat, requested); 718 720 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); 719 721 spin_unlock(&mirror->lock); 720 722 ··· 728 724 static void 729 725 nfs4_ff_layout_stat_io_end_read(struct rpc_task *task, 730 726 struct nfs4_ff_layout_mirror *mirror, 727 + u32 dss_id, 731 728 __u64 requested, 732 729 __u64 completed) 733 730 { 734 731 spin_lock(&mirror->lock); 735 - nfs4_ff_layout_stat_io_update_completed(&mirror->dss[0].read_stat, 732 + nfs4_ff_layout_stat_io_update_completed(&mirror->dss[dss_id].read_stat, 736 733 requested, completed, 737 734 ktime_get(), task->tk_start); 738 735 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); ··· 743 738 static void 744 739 nfs4_ff_layout_stat_io_start_write(struct inode *inode, 745 740 struct nfs4_ff_layout_mirror *mirror, 741 + u32 dss_id, 746 742 __u64 requested, ktime_t now) 747 743 { 748 744 bool report; 749 745 750 746 spin_lock(&mirror->lock); 751 - report = nfs4_ff_layoutstat_start_io(mirror, &mirror->dss[0].write_stat, now); 752 - nfs4_ff_layout_stat_io_update_requested(&mirror->dss[0].write_stat, requested); 747 + report = nfs4_ff_layoutstat_start_io( 748 + mirror, 749 + dss_id, 750 + &mirror->dss[dss_id].write_stat, 751 + now); 752 + nfs4_ff_layout_stat_io_update_requested( 753 + &mirror->dss[dss_id].write_stat, 754 + requested); 753 755 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); 754 756 spin_unlock(&mirror->lock); 755 757 ··· 767 755 static void 768 756 nfs4_ff_layout_stat_io_end_write(struct rpc_task *task, 769 757 struct nfs4_ff_layout_mirror *mirror, 758 + u32 dss_id, 770 759 __u64 requested, 771 760 __u64 completed, 772 761 enum nfs3_stable_how committed) ··· 776 763 requested = completed = 0; 777 764 778 765 spin_lock(&mirror->lock); 779 - nfs4_ff_layout_stat_io_update_completed(&mirror->dss[0].write_stat, 766 + nfs4_ff_layout_stat_io_update_completed(&mirror->dss[dss_id].write_stat, 780 767 requested, completed, ktime_get(), task->tk_start); 781 768 set_bit(NFS4_FF_MIRROR_STAT_AVAIL, &mirror->flags); 782 769 spin_unlock(&mirror->lock); 783 770 } 784 771 785 772 static void 786 - ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, u32 idx) 773 + ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, u32 idx, u32 dss_id) 787 774 { 788 - struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx, 0); 775 + struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx, dss_id); 789 776 790 777 if (devid) 791 778 nfs4_mark_deviceid_unavailable(devid); 792 779 } 793 780 794 781 static void 795 - ff_layout_mark_ds_reachable(struct pnfs_layout_segment *lseg, u32 idx) 782 + ff_layout_mark_ds_reachable(struct pnfs_layout_segment *lseg, u32 idx, u32 dss_id) 796 783 { 797 - struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx, 0); 784 + struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx, dss_id); 798 785 799 786 if (devid) 800 787 nfs4_mark_deviceid_available(devid); ··· 1232 1219 struct nfs4_state *state, 1233 1220 struct nfs_client *clp, 1234 1221 struct pnfs_layout_segment *lseg, 1235 - u32 idx) 1222 + u32 idx, u32 dss_id) 1236 1223 { 1237 1224 struct pnfs_layout_hdr *lo = lseg->pls_layout; 1238 1225 struct inode *inode = lo->plh_inode; 1239 - struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx, 0); 1226 + struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx, dss_id); 1240 1227 struct nfs4_slot_table *tbl = &clp->cl_session->fc_slot_table; 1241 1228 1242 1229 switch (op_status) { ··· 1333 1320 u32 op_status, 1334 1321 struct nfs_client *clp, 1335 1322 struct pnfs_layout_segment *lseg, 1336 - u32 idx) 1323 + u32 idx, u32 dss_id) 1337 1324 { 1338 - struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx, 0); 1325 + struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx, dss_id); 1339 1326 1340 1327 switch (op_status) { 1341 1328 case NFS_OK: ··· 1399 1386 struct nfs4_state *state, 1400 1387 struct nfs_client *clp, 1401 1388 struct pnfs_layout_segment *lseg, 1402 - u32 idx) 1389 + u32 idx, u32 dss_id) 1403 1390 { 1404 1391 int vers = clp->cl_nfs_mod->rpc_vers->number; 1405 1392 1406 1393 if (task->tk_status >= 0) { 1407 - ff_layout_mark_ds_reachable(lseg, idx); 1394 + ff_layout_mark_ds_reachable(lseg, idx, dss_id); 1408 1395 return 0; 1409 1396 } 1410 1397 ··· 1415 1402 switch (vers) { 1416 1403 case 3: 1417 1404 return ff_layout_async_handle_error_v3(task, op_status, clp, 1418 - lseg, idx); 1405 + lseg, idx, dss_id); 1419 1406 case 4: 1420 1407 return ff_layout_async_handle_error_v4(task, op_status, state, 1421 - clp, lseg, idx); 1408 + clp, lseg, idx, dss_id); 1422 1409 default: 1423 1410 /* should never happen */ 1424 1411 WARN_ON_ONCE(1); ··· 1427 1414 } 1428 1415 1429 1416 static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg, 1430 - u32 idx, u64 offset, u64 length, 1417 + u32 idx, u32 dss_id, u64 offset, u64 length, 1431 1418 u32 *op_status, int opnum, int error) 1432 1419 { 1433 1420 struct nfs4_ff_layout_mirror *mirror; ··· 1465 1452 1466 1453 mirror = FF_LAYOUT_COMP(lseg, idx); 1467 1454 err = ff_layout_track_ds_error(FF_LAYOUT_FROM_HDR(lseg->pls_layout), 1468 - mirror, 0, offset, length, status, opnum, 1455 + mirror, dss_id, offset, length, status, opnum, 1469 1456 nfs_io_gfp_mask()); 1470 1457 1471 1458 switch (status) { ··· 1474 1461 case NFS4ERR_PERM: 1475 1462 break; 1476 1463 case NFS4ERR_NXIO: 1477 - ff_layout_mark_ds_unreachable(lseg, idx); 1464 + ff_layout_mark_ds_unreachable(lseg, idx, dss_id); 1478 1465 /* 1479 1466 * Don't return the layout if this is a read and we still 1480 1467 * have layouts to try ··· 1494 1481 static int ff_layout_read_done_cb(struct rpc_task *task, 1495 1482 struct nfs_pgio_header *hdr) 1496 1483 { 1484 + struct nfs4_ff_layout_segment *flseg = FF_LAYOUT_LSEG(hdr->lseg); 1485 + u32 dss_id = nfs4_ff_layout_calc_dss_id( 1486 + flseg->stripe_unit, 1487 + flseg->mirror_array[hdr->pgio_mirror_idx]->dss_count, 1488 + hdr->args.offset); 1497 1489 int err; 1498 1490 1499 1491 if (task->tk_status < 0) { 1500 - ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx, 1492 + ff_layout_io_track_ds_error(hdr->lseg, 1493 + hdr->pgio_mirror_idx, dss_id, 1501 1494 hdr->args.offset, hdr->args.count, 1502 1495 &hdr->res.op_status, OP_READ, 1503 1496 task->tk_status); ··· 1513 1494 err = ff_layout_async_handle_error(task, hdr->res.op_status, 1514 1495 hdr->args.context->state, 1515 1496 hdr->ds_clp, hdr->lseg, 1516 - hdr->pgio_mirror_idx); 1497 + hdr->pgio_mirror_idx, 1498 + dss_id); 1517 1499 1518 1500 trace_nfs4_pnfs_read(hdr, err); 1519 1501 clear_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags); ··· 1570 1550 static void ff_layout_read_record_layoutstats_start(struct rpc_task *task, 1571 1551 struct nfs_pgio_header *hdr) 1572 1552 { 1553 + struct nfs4_ff_layout_mirror *mirror; 1554 + u32 dss_id; 1555 + 1573 1556 if (test_and_set_bit(NFS_IOHDR_STAT, &hdr->flags)) 1574 1557 return; 1575 - nfs4_ff_layout_stat_io_start_read(hdr->inode, 1576 - FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx), 1577 - hdr->args.count, 1578 - task->tk_start); 1558 + 1559 + mirror = FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx); 1560 + dss_id = nfs4_ff_layout_calc_dss_id( 1561 + FF_LAYOUT_LSEG(hdr->lseg)->stripe_unit, 1562 + mirror->dss_count, 1563 + hdr->args.offset); 1564 + 1565 + nfs4_ff_layout_stat_io_start_read( 1566 + hdr->inode, 1567 + mirror, 1568 + dss_id, 1569 + hdr->args.count, 1570 + task->tk_start); 1579 1571 } 1580 1572 1581 1573 static void ff_layout_read_record_layoutstats_done(struct rpc_task *task, 1582 1574 struct nfs_pgio_header *hdr) 1583 1575 { 1576 + struct nfs4_ff_layout_mirror *mirror; 1577 + u32 dss_id; 1578 + 1584 1579 if (!test_and_clear_bit(NFS_IOHDR_STAT, &hdr->flags)) 1585 1580 return; 1586 - nfs4_ff_layout_stat_io_end_read(task, 1587 - FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx), 1588 - hdr->args.count, 1589 - hdr->res.count); 1581 + 1582 + mirror = FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx); 1583 + dss_id = nfs4_ff_layout_calc_dss_id( 1584 + FF_LAYOUT_LSEG(hdr->lseg)->stripe_unit, 1585 + mirror->dss_count, 1586 + hdr->args.offset); 1587 + 1588 + nfs4_ff_layout_stat_io_end_read( 1589 + task, 1590 + mirror, 1591 + dss_id, 1592 + hdr->args.count, 1593 + hdr->res.count); 1590 1594 set_bit(NFS_LSEG_LAYOUTRETURN, &hdr->lseg->pls_flags); 1591 1595 } 1592 1596 ··· 1698 1654 static int ff_layout_write_done_cb(struct rpc_task *task, 1699 1655 struct nfs_pgio_header *hdr) 1700 1656 { 1657 + struct nfs4_ff_layout_segment *flseg = FF_LAYOUT_LSEG(hdr->lseg); 1658 + u32 dss_id = nfs4_ff_layout_calc_dss_id( 1659 + flseg->stripe_unit, 1660 + flseg->mirror_array[hdr->pgio_mirror_idx]->dss_count, 1661 + hdr->args.offset); 1701 1662 loff_t end_offs = 0; 1702 1663 int err; 1703 1664 1704 1665 if (task->tk_status < 0) { 1705 - ff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx, 1666 + ff_layout_io_track_ds_error(hdr->lseg, 1667 + hdr->pgio_mirror_idx, dss_id, 1706 1668 hdr->args.offset, hdr->args.count, 1707 1669 &hdr->res.op_status, OP_WRITE, 1708 1670 task->tk_status); ··· 1718 1668 err = ff_layout_async_handle_error(task, hdr->res.op_status, 1719 1669 hdr->args.context->state, 1720 1670 hdr->ds_clp, hdr->lseg, 1721 - hdr->pgio_mirror_idx); 1671 + hdr->pgio_mirror_idx, 1672 + dss_id); 1722 1673 1723 1674 trace_nfs4_pnfs_write(hdr, err); 1724 1675 clear_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags); ··· 1757 1706 struct nfs_commit_data *data) 1758 1707 { 1759 1708 int err; 1709 + u32 idx = calc_mirror_idx_from_commit(data->lseg, data->ds_commit_index); 1710 + u32 dss_id = calc_dss_id_from_commit(data->lseg, data->ds_commit_index); 1760 1711 1761 1712 if (task->tk_status < 0) { 1762 - ff_layout_io_track_ds_error(data->lseg, data->ds_commit_index, 1713 + ff_layout_io_track_ds_error(data->lseg, idx, dss_id, 1763 1714 data->args.offset, data->args.count, 1764 1715 &data->res.op_status, OP_COMMIT, 1765 1716 task->tk_status); ··· 1769 1716 } 1770 1717 1771 1718 err = ff_layout_async_handle_error(task, data->res.op_status, 1772 - NULL, data->ds_clp, data->lseg, 1773 - data->ds_commit_index); 1719 + NULL, data->ds_clp, data->lseg, idx, 1720 + dss_id); 1774 1721 1775 1722 trace_nfs4_pnfs_commit_ds(data, err); 1776 1723 switch (err) { ··· 1789 1736 } 1790 1737 1791 1738 ff_layout_set_layoutcommit(data->inode, data->lseg, data->lwb); 1792 - 1793 1739 return 0; 1794 1740 } 1795 1741 1796 1742 static void ff_layout_write_record_layoutstats_start(struct rpc_task *task, 1797 1743 struct nfs_pgio_header *hdr) 1798 1744 { 1745 + struct nfs4_ff_layout_mirror *mirror; 1746 + u32 dss_id; 1747 + 1799 1748 if (test_and_set_bit(NFS_IOHDR_STAT, &hdr->flags)) 1800 1749 return; 1801 - nfs4_ff_layout_stat_io_start_write(hdr->inode, 1802 - FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx), 1803 - hdr->args.count, 1804 - task->tk_start); 1750 + 1751 + mirror = FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx); 1752 + dss_id = nfs4_ff_layout_calc_dss_id( 1753 + FF_LAYOUT_LSEG(hdr->lseg)->stripe_unit, 1754 + mirror->dss_count, 1755 + hdr->args.offset); 1756 + 1757 + nfs4_ff_layout_stat_io_start_write( 1758 + hdr->inode, 1759 + mirror, 1760 + dss_id, 1761 + hdr->args.count, 1762 + task->tk_start); 1805 1763 } 1806 1764 1807 1765 static void ff_layout_write_record_layoutstats_done(struct rpc_task *task, 1808 1766 struct nfs_pgio_header *hdr) 1809 1767 { 1768 + struct nfs4_ff_layout_mirror *mirror; 1769 + u32 dss_id; 1770 + 1810 1771 if (!test_and_clear_bit(NFS_IOHDR_STAT, &hdr->flags)) 1811 1772 return; 1812 - nfs4_ff_layout_stat_io_end_write(task, 1813 - FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx), 1814 - hdr->args.count, hdr->res.count, 1815 - hdr->res.verf->committed); 1773 + 1774 + mirror = FF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx); 1775 + dss_id = nfs4_ff_layout_calc_dss_id( 1776 + FF_LAYOUT_LSEG(hdr->lseg)->stripe_unit, 1777 + mirror->dss_count, 1778 + hdr->args.offset); 1779 + 1780 + nfs4_ff_layout_stat_io_end_write( 1781 + task, 1782 + mirror, 1783 + dss_id, 1784 + hdr->args.count, 1785 + hdr->res.count, 1786 + hdr->res.verf->committed); 1816 1787 set_bit(NFS_LSEG_LAYOUTRETURN, &hdr->lseg->pls_flags); 1817 1788 } 1818 1789 ··· 1919 1842 static void ff_layout_commit_record_layoutstats_start(struct rpc_task *task, 1920 1843 struct nfs_commit_data *cdata) 1921 1844 { 1845 + u32 idx, dss_id; 1846 + 1922 1847 if (test_and_set_bit(NFS_IOHDR_STAT, &cdata->flags)) 1923 1848 return; 1849 + 1850 + idx = calc_mirror_idx_from_commit(cdata->lseg, cdata->ds_commit_index); 1851 + dss_id = calc_dss_id_from_commit(cdata->lseg, cdata->ds_commit_index); 1924 1852 nfs4_ff_layout_stat_io_start_write(cdata->inode, 1925 - FF_LAYOUT_COMP(cdata->lseg, cdata->ds_commit_index), 1853 + FF_LAYOUT_COMP(cdata->lseg, idx), 1854 + dss_id, 1926 1855 0, task->tk_start); 1927 1856 } 1928 1857 ··· 1937 1854 { 1938 1855 struct nfs_page *req; 1939 1856 __u64 count = 0; 1857 + u32 idx, dss_id; 1940 1858 1941 1859 if (!test_and_clear_bit(NFS_IOHDR_STAT, &cdata->flags)) 1942 1860 return; ··· 1946 1862 list_for_each_entry(req, &cdata->pages, wb_list) 1947 1863 count += req->wb_bytes; 1948 1864 } 1865 + 1866 + idx = calc_mirror_idx_from_commit(cdata->lseg, cdata->ds_commit_index); 1867 + dss_id = calc_dss_id_from_commit(cdata->lseg, cdata->ds_commit_index); 1949 1868 nfs4_ff_layout_stat_io_end_write(task, 1950 - FF_LAYOUT_COMP(cdata->lseg, cdata->ds_commit_index), 1869 + FF_LAYOUT_COMP(cdata->lseg, idx), 1870 + dss_id, 1951 1871 count, count, NFS_FILE_SYNC); 1952 1872 set_bit(NFS_LSEG_LAYOUTRETURN, &cdata->lseg->pls_flags); 1953 1873 } ··· 2344 2256 struct nfs4_pnfs_ds *ds; 2345 2257 struct nfs_client *ds_clp; 2346 2258 struct rpc_clnt *clnt; 2347 - u32 idx; 2259 + u32 idx, dss_id; 2348 2260 2349 2261 for (idx = 0; idx < flseg->mirror_array_cnt; idx++) { 2350 2262 mirror = flseg->mirror_array[idx]; 2351 - mirror_ds = mirror->dss[0].mirror_ds; 2352 - if (IS_ERR_OR_NULL(mirror_ds)) 2353 - continue; 2354 - ds = mirror->dss[0].mirror_ds->ds; 2355 - if (!ds) 2356 - continue; 2357 - ds_clp = ds->ds_clp; 2358 - if (!ds_clp) 2359 - continue; 2360 - clnt = ds_clp->cl_rpcclient; 2361 - if (!clnt) 2362 - continue; 2363 - if (!rpc_cancel_tasks(clnt, -EAGAIN, ff_layout_match_io, lseg)) 2364 - continue; 2365 - rpc_clnt_disconnect(clnt); 2263 + for (dss_id = 0; dss_id < mirror->dss_count; dss_id++) { 2264 + mirror_ds = mirror->dss[dss_id].mirror_ds; 2265 + if (IS_ERR_OR_NULL(mirror_ds)) 2266 + continue; 2267 + ds = mirror->dss[dss_id].mirror_ds->ds; 2268 + if (!ds) 2269 + continue; 2270 + ds_clp = ds->ds_clp; 2271 + if (!ds_clp) 2272 + continue; 2273 + clnt = ds_clp->cl_rpcclient; 2274 + if (!clnt) 2275 + continue; 2276 + if (!rpc_cancel_tasks(clnt, -EAGAIN, 2277 + ff_layout_match_io, lseg)) 2278 + continue; 2279 + rpc_clnt_disconnect(clnt); 2280 + } 2366 2281 } 2367 2282 } 2368 2283 ··· 2753 2662 static void 2754 2663 ff_layout_encode_ff_layoutupdate(struct xdr_stream *xdr, 2755 2664 const struct nfs42_layoutstat_devinfo *devinfo, 2756 - struct nfs4_ff_layout_mirror *mirror) 2665 + struct nfs4_ff_layout_ds_stripe *dss_info) 2757 2666 { 2758 2667 struct nfs4_pnfs_ds_addr *da; 2759 - struct nfs4_pnfs_ds *ds = mirror->dss[0].mirror_ds->ds; 2760 - struct nfs_fh *fh = &mirror->dss[0].fh_versions[0]; 2668 + struct nfs4_pnfs_ds *ds = dss_info->mirror_ds->ds; 2669 + struct nfs_fh *fh = &dss_info->fh_versions[0]; 2761 2670 __be32 *p; 2762 2671 2763 2672 da = list_first_entry(&ds->ds_addrs, struct nfs4_pnfs_ds_addr, da_node); ··· 2769 2678 p = xdr_reserve_space(xdr, 4 + fh->size); 2770 2679 xdr_encode_opaque(p, fh->data, fh->size); 2771 2680 /* ff_io_latency4 read */ 2772 - spin_lock(&mirror->lock); 2773 - ff_layout_encode_io_latency(xdr, &mirror->dss[0].read_stat.io_stat); 2681 + spin_lock(&dss_info->mirror->lock); 2682 + ff_layout_encode_io_latency(xdr, 2683 + &dss_info->read_stat.io_stat); 2774 2684 /* ff_io_latency4 write */ 2775 - ff_layout_encode_io_latency(xdr, &mirror->dss[0].write_stat.io_stat); 2776 - spin_unlock(&mirror->lock); 2685 + ff_layout_encode_io_latency(xdr, 2686 + &dss_info->write_stat.io_stat); 2687 + spin_unlock(&dss_info->mirror->lock); 2777 2688 /* nfstime4 */ 2778 - ff_layout_encode_nfstime(xdr, ktime_sub(ktime_get(), mirror->dss[0].start_time)); 2689 + ff_layout_encode_nfstime(xdr, 2690 + ktime_sub(ktime_get(), 2691 + dss_info->start_time)); 2779 2692 /* bool */ 2780 2693 p = xdr_reserve_space(xdr, 4); 2781 2694 *p = cpu_to_be32(false); ··· 2803 2708 static void 2804 2709 ff_layout_free_layoutstats(struct nfs4_xdr_opaque_data *opaque) 2805 2710 { 2806 - struct nfs4_ff_layout_mirror *mirror = opaque->data; 2711 + struct nfs4_ff_layout_ds_stripe *dss_info = opaque->data; 2712 + struct nfs4_ff_layout_mirror *mirror = dss_info->mirror; 2807 2713 2808 2714 ff_layout_put_mirror(mirror); 2809 2715 } ··· 2821 2725 { 2822 2726 struct nfs4_flexfile_layout *ff_layout = FF_LAYOUT_FROM_HDR(lo); 2823 2727 struct nfs4_ff_layout_mirror *mirror; 2728 + struct nfs4_ff_layout_ds_stripe *dss_info; 2824 2729 struct nfs4_deviceid_node *dev; 2825 - int i = 0; 2730 + int i = 0, dss_id; 2826 2731 2827 2732 list_for_each_entry(mirror, &ff_layout->mirrors, mirrors) { 2828 - if (i >= dev_limit) 2829 - break; 2830 - if (IS_ERR_OR_NULL(mirror->dss[0].mirror_ds)) 2831 - continue; 2832 - if (!test_and_clear_bit(NFS4_FF_MIRROR_STAT_AVAIL, 2833 - &mirror->flags) && 2834 - type != NFS4_FF_OP_LAYOUTRETURN) 2835 - continue; 2836 - /* mirror refcount put in cleanup_layoutstats */ 2837 - if (!refcount_inc_not_zero(&mirror->ref)) 2838 - continue; 2839 - dev = &mirror->dss[0].mirror_ds->id_node; 2840 - memcpy(&devinfo->dev_id, &dev->deviceid, NFS4_DEVICEID4_SIZE); 2841 - devinfo->offset = 0; 2842 - devinfo->length = NFS4_MAX_UINT64; 2843 - spin_lock(&mirror->lock); 2844 - devinfo->read_count = mirror->dss[0].read_stat.io_stat.ops_completed; 2845 - devinfo->read_bytes = mirror->dss[0].read_stat.io_stat.bytes_completed; 2846 - devinfo->write_count = mirror->dss[0].write_stat.io_stat.ops_completed; 2847 - devinfo->write_bytes = mirror->dss[0].write_stat.io_stat.bytes_completed; 2848 - spin_unlock(&mirror->lock); 2849 - devinfo->layout_type = LAYOUT_FLEX_FILES; 2850 - devinfo->ld_private.ops = &layoutstat_ops; 2851 - devinfo->ld_private.data = mirror; 2733 + for (dss_id = 0; dss_id < mirror->dss_count; ++dss_id) { 2734 + dss_info = &mirror->dss[dss_id]; 2735 + if (i >= dev_limit) 2736 + break; 2737 + if (IS_ERR_OR_NULL(dss_info->mirror_ds)) 2738 + continue; 2739 + if (!test_and_clear_bit(NFS4_FF_MIRROR_STAT_AVAIL, 2740 + &mirror->flags) && 2741 + type != NFS4_FF_OP_LAYOUTRETURN) 2742 + continue; 2743 + /* mirror refcount put in cleanup_layoutstats */ 2744 + if (!refcount_inc_not_zero(&mirror->ref)) 2745 + continue; 2746 + dev = &dss_info->mirror_ds->id_node; 2747 + memcpy(&devinfo->dev_id, 2748 + &dev->deviceid, 2749 + NFS4_DEVICEID4_SIZE); 2750 + devinfo->offset = 0; 2751 + devinfo->length = NFS4_MAX_UINT64; 2752 + spin_lock(&mirror->lock); 2753 + devinfo->read_count = 2754 + dss_info->read_stat.io_stat.ops_completed; 2755 + devinfo->read_bytes = 2756 + dss_info->read_stat.io_stat.bytes_completed; 2757 + devinfo->write_count = 2758 + dss_info->write_stat.io_stat.ops_completed; 2759 + devinfo->write_bytes = 2760 + dss_info->write_stat.io_stat.bytes_completed; 2761 + spin_unlock(&mirror->lock); 2762 + devinfo->layout_type = LAYOUT_FLEX_FILES; 2763 + devinfo->ld_private.ops = &layoutstat_ops; 2764 + devinfo->ld_private.data = &mirror->dss[dss_id]; 2852 2765 2853 - devinfo++; 2854 - i++; 2766 + devinfo++; 2767 + i++; 2768 + } 2855 2769 } 2856 2770 return i; 2857 2771 }