diff options
author | Peng Tao <tao.peng@primarydata.com> | 2014-11-09 19:35:35 -0500 |
---|---|---|
committer | Tom Haynes <loghyr@primarydata.com> | 2015-02-03 14:06:48 -0500 |
commit | 48d635f14a544c2b3ca870d2c7349b41160496d2 (patch) | |
tree | 3482ecc1445a13fb60941213930078da302869ff /fs/nfs/pnfs.c | |
parent | 47af81f29556a45493e5c87289c3c16ce911096c (diff) |
nfs: add nfs_pgio_current_mirror helper
Let it return current nfs_pgio_mirror in use depending on pg_mirror_count.
For read, we always use pg_mirrors[0], so this effectively gives us freedom
to use pg_mirror_idx to track the actual mirror to read from through out the
IO stack.
Signed-off-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Tom Haynes <loghyr@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r-- | fs/nfs/pnfs.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index e123cfce54ee..b822b1749643 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1731,7 +1731,7 @@ static void | |||
1731 | pnfs_write_through_mds(struct nfs_pageio_descriptor *desc, | 1731 | pnfs_write_through_mds(struct nfs_pageio_descriptor *desc, |
1732 | struct nfs_pgio_header *hdr) | 1732 | struct nfs_pgio_header *hdr) |
1733 | { | 1733 | { |
1734 | struct nfs_pgio_mirror *mirror = &desc->pg_mirrors[desc->pg_mirror_idx]; | 1734 | struct nfs_pgio_mirror *mirror = nfs_pgio_current_mirror(desc); |
1735 | 1735 | ||
1736 | if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) { | 1736 | if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) { |
1737 | list_splice_tail_init(&hdr->pages, &mirror->pg_list); | 1737 | list_splice_tail_init(&hdr->pages, &mirror->pg_list); |
@@ -1785,7 +1785,7 @@ EXPORT_SYMBOL_GPL(pnfs_writehdr_free); | |||
1785 | int | 1785 | int |
1786 | pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc) | 1786 | pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc) |
1787 | { | 1787 | { |
1788 | struct nfs_pgio_mirror *mirror = &desc->pg_mirrors[desc->pg_mirror_idx]; | 1788 | struct nfs_pgio_mirror *mirror = nfs_pgio_current_mirror(desc); |
1789 | 1789 | ||
1790 | struct nfs_pgio_header *hdr; | 1790 | struct nfs_pgio_header *hdr; |
1791 | int ret; | 1791 | int ret; |
@@ -1846,8 +1846,7 @@ static void | |||
1846 | pnfs_read_through_mds(struct nfs_pageio_descriptor *desc, | 1846 | pnfs_read_through_mds(struct nfs_pageio_descriptor *desc, |
1847 | struct nfs_pgio_header *hdr) | 1847 | struct nfs_pgio_header *hdr) |
1848 | { | 1848 | { |
1849 | struct nfs_pgio_mirror *mirror = &desc->pg_mirrors[desc->pg_mirror_idx]; | 1849 | struct nfs_pgio_mirror *mirror = nfs_pgio_current_mirror(desc); |
1850 | |||
1851 | 1850 | ||
1852 | if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) { | 1851 | if (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) { |
1853 | list_splice_tail_init(&hdr->pages, &mirror->pg_list); | 1852 | list_splice_tail_init(&hdr->pages, &mirror->pg_list); |
@@ -1903,7 +1902,7 @@ EXPORT_SYMBOL_GPL(pnfs_readhdr_free); | |||
1903 | int | 1902 | int |
1904 | pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc) | 1903 | pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc) |
1905 | { | 1904 | { |
1906 | struct nfs_pgio_mirror *mirror = &desc->pg_mirrors[desc->pg_mirror_idx]; | 1905 | struct nfs_pgio_mirror *mirror = nfs_pgio_current_mirror(desc); |
1907 | 1906 | ||
1908 | struct nfs_pgio_header *hdr; | 1907 | struct nfs_pgio_header *hdr; |
1909 | int ret; | 1908 | int ret; |