diff options
author | Weston Andros Adamson <dros@primarydata.com> | 2014-06-09 11:48:33 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-06-24 18:46:59 -0400 |
commit | 1e7f3a485922211b6e4a082ebc6bf05810b0b6ea (patch) | |
tree | 409983ab4e7f9e880f31afd0648eb3ca039e1b5a /fs/nfs/pnfs.c | |
parent | 66b068604903849c5dee3842eb72564064c64c72 (diff) |
nfs: move nfs_pgio_data and remove nfs_rw_header
nfs_rw_header was used to allocate an nfs_pgio_header along with an
nfs_pgio_data, because a _header would need at least one _data.
Now there is only ever one nfs_pgio_data for each nfs_pgio_header -- move
it to nfs_pgio_header and get rid of nfs_rw_header.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Weston Andros Adamson <dros@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/pnfs.c')
-rw-r--r-- | fs/nfs/pnfs.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 6fdcd233d6f7..067104cce181 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -1546,7 +1546,7 @@ pnfs_write_through_mds(struct nfs_pageio_descriptor *desc, | |||
1546 | nfs_pageio_reset_write_mds(desc); | 1546 | nfs_pageio_reset_write_mds(desc); |
1547 | desc->pg_recoalesce = 1; | 1547 | desc->pg_recoalesce = 1; |
1548 | } | 1548 | } |
1549 | nfs_pgio_data_release(data); | 1549 | nfs_pgio_data_destroy(data); |
1550 | } | 1550 | } |
1551 | 1551 | ||
1552 | static enum pnfs_try_status | 1552 | static enum pnfs_try_status |
@@ -1575,7 +1575,7 @@ static void | |||
1575 | pnfs_do_write(struct nfs_pageio_descriptor *desc, | 1575 | pnfs_do_write(struct nfs_pageio_descriptor *desc, |
1576 | struct nfs_pgio_header *hdr, int how) | 1576 | struct nfs_pgio_header *hdr, int how) |
1577 | { | 1577 | { |
1578 | struct nfs_pgio_data *data = hdr->data; | 1578 | struct nfs_pgio_data *data = &hdr->data; |
1579 | const struct rpc_call_ops *call_ops = desc->pg_rpc_callops; | 1579 | const struct rpc_call_ops *call_ops = desc->pg_rpc_callops; |
1580 | struct pnfs_layout_segment *lseg = desc->pg_lseg; | 1580 | struct pnfs_layout_segment *lseg = desc->pg_lseg; |
1581 | enum pnfs_try_status trypnfs; | 1581 | enum pnfs_try_status trypnfs; |
@@ -1590,25 +1590,23 @@ pnfs_do_write(struct nfs_pageio_descriptor *desc, | |||
1590 | static void pnfs_writehdr_free(struct nfs_pgio_header *hdr) | 1590 | static void pnfs_writehdr_free(struct nfs_pgio_header *hdr) |
1591 | { | 1591 | { |
1592 | pnfs_put_lseg(hdr->lseg); | 1592 | pnfs_put_lseg(hdr->lseg); |
1593 | nfs_rw_header_free(hdr); | 1593 | nfs_pgio_header_free(hdr); |
1594 | } | 1594 | } |
1595 | EXPORT_SYMBOL_GPL(pnfs_writehdr_free); | 1595 | EXPORT_SYMBOL_GPL(pnfs_writehdr_free); |
1596 | 1596 | ||
1597 | int | 1597 | int |
1598 | pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc) | 1598 | pnfs_generic_pg_writepages(struct nfs_pageio_descriptor *desc) |
1599 | { | 1599 | { |
1600 | struct nfs_rw_header *whdr; | ||
1601 | struct nfs_pgio_header *hdr; | 1600 | struct nfs_pgio_header *hdr; |
1602 | int ret; | 1601 | int ret; |
1603 | 1602 | ||
1604 | whdr = nfs_rw_header_alloc(desc->pg_rw_ops); | 1603 | hdr = nfs_pgio_header_alloc(desc->pg_rw_ops); |
1605 | if (!whdr) { | 1604 | if (!hdr) { |
1606 | desc->pg_completion_ops->error_cleanup(&desc->pg_list); | 1605 | desc->pg_completion_ops->error_cleanup(&desc->pg_list); |
1607 | pnfs_put_lseg(desc->pg_lseg); | 1606 | pnfs_put_lseg(desc->pg_lseg); |
1608 | desc->pg_lseg = NULL; | 1607 | desc->pg_lseg = NULL; |
1609 | return -ENOMEM; | 1608 | return -ENOMEM; |
1610 | } | 1609 | } |
1611 | hdr = &whdr->header; | ||
1612 | nfs_pgheader_init(desc, hdr, pnfs_writehdr_free); | 1610 | nfs_pgheader_init(desc, hdr, pnfs_writehdr_free); |
1613 | hdr->lseg = pnfs_get_lseg(desc->pg_lseg); | 1611 | hdr->lseg = pnfs_get_lseg(desc->pg_lseg); |
1614 | atomic_inc(&hdr->refcnt); | 1612 | atomic_inc(&hdr->refcnt); |
@@ -1696,7 +1694,7 @@ pnfs_read_through_mds(struct nfs_pageio_descriptor *desc, | |||
1696 | nfs_pageio_reset_read_mds(desc); | 1694 | nfs_pageio_reset_read_mds(desc); |
1697 | desc->pg_recoalesce = 1; | 1695 | desc->pg_recoalesce = 1; |
1698 | } | 1696 | } |
1699 | nfs_pgio_data_release(data); | 1697 | nfs_pgio_data_destroy(data); |
1700 | } | 1698 | } |
1701 | 1699 | ||
1702 | /* | 1700 | /* |
@@ -1727,7 +1725,7 @@ pnfs_try_to_read_data(struct nfs_pgio_data *rdata, | |||
1727 | static void | 1725 | static void |
1728 | pnfs_do_read(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr) | 1726 | pnfs_do_read(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr) |
1729 | { | 1727 | { |
1730 | struct nfs_pgio_data *data = hdr->data; | 1728 | struct nfs_pgio_data *data = &hdr->data; |
1731 | const struct rpc_call_ops *call_ops = desc->pg_rpc_callops; | 1729 | const struct rpc_call_ops *call_ops = desc->pg_rpc_callops; |
1732 | struct pnfs_layout_segment *lseg = desc->pg_lseg; | 1730 | struct pnfs_layout_segment *lseg = desc->pg_lseg; |
1733 | enum pnfs_try_status trypnfs; | 1731 | enum pnfs_try_status trypnfs; |
@@ -1742,26 +1740,24 @@ pnfs_do_read(struct nfs_pageio_descriptor *desc, struct nfs_pgio_header *hdr) | |||
1742 | static void pnfs_readhdr_free(struct nfs_pgio_header *hdr) | 1740 | static void pnfs_readhdr_free(struct nfs_pgio_header *hdr) |
1743 | { | 1741 | { |
1744 | pnfs_put_lseg(hdr->lseg); | 1742 | pnfs_put_lseg(hdr->lseg); |
1745 | nfs_rw_header_free(hdr); | 1743 | nfs_pgio_header_free(hdr); |
1746 | } | 1744 | } |
1747 | EXPORT_SYMBOL_GPL(pnfs_readhdr_free); | 1745 | EXPORT_SYMBOL_GPL(pnfs_readhdr_free); |
1748 | 1746 | ||
1749 | int | 1747 | int |
1750 | pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc) | 1748 | pnfs_generic_pg_readpages(struct nfs_pageio_descriptor *desc) |
1751 | { | 1749 | { |
1752 | struct nfs_rw_header *rhdr; | ||
1753 | struct nfs_pgio_header *hdr; | 1750 | struct nfs_pgio_header *hdr; |
1754 | int ret; | 1751 | int ret; |
1755 | 1752 | ||
1756 | rhdr = nfs_rw_header_alloc(desc->pg_rw_ops); | 1753 | hdr = nfs_pgio_header_alloc(desc->pg_rw_ops); |
1757 | if (!rhdr) { | 1754 | if (!hdr) { |
1758 | desc->pg_completion_ops->error_cleanup(&desc->pg_list); | 1755 | desc->pg_completion_ops->error_cleanup(&desc->pg_list); |
1759 | ret = -ENOMEM; | 1756 | ret = -ENOMEM; |
1760 | pnfs_put_lseg(desc->pg_lseg); | 1757 | pnfs_put_lseg(desc->pg_lseg); |
1761 | desc->pg_lseg = NULL; | 1758 | desc->pg_lseg = NULL; |
1762 | return ret; | 1759 | return ret; |
1763 | } | 1760 | } |
1764 | hdr = &rhdr->header; | ||
1765 | nfs_pgheader_init(desc, hdr, pnfs_readhdr_free); | 1761 | nfs_pgheader_init(desc, hdr, pnfs_readhdr_free); |
1766 | hdr->lseg = pnfs_get_lseg(desc->pg_lseg); | 1762 | hdr->lseg = pnfs_get_lseg(desc->pg_lseg); |
1767 | atomic_inc(&hdr->refcnt); | 1763 | atomic_inc(&hdr->refcnt); |