diff options
author | Martin Brandenburg <martin@omnibond.com> | 2018-03-20 13:00:12 -0400 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2018-04-02 08:10:17 -0400 |
commit | dbcb5e7fc470c9daec9cb4ae463670f2047163e3 (patch) | |
tree | 15104956a7f0654edf79a97b6c4d86a0c203a16c | |
parent | 81e3d0253f87d369a1d957eb3173fd596126383c (diff) |
orangefs: open code short single-use functions
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
-rw-r--r-- | fs/orangefs/file.c | 95 |
1 files changed, 19 insertions, 76 deletions
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c index 0d228cd087e6..3a7319a1bfdb 100644 --- a/fs/orangefs/file.c +++ b/fs/orangefs/file.c | |||
@@ -42,70 +42,6 @@ static int flush_racache(struct inode *inode) | |||
42 | } | 42 | } |
43 | 43 | ||
44 | /* | 44 | /* |
45 | * Copy to client-core's address space from the buffers specified | ||
46 | * by the iovec upto total_size bytes. | ||
47 | * NOTE: the iovector can either contain addresses which | ||
48 | * can futher be kernel-space or user-space addresses. | ||
49 | * or it can pointers to struct page's | ||
50 | */ | ||
51 | static int precopy_buffers(int buffer_index, | ||
52 | struct iov_iter *iter, | ||
53 | size_t total_size) | ||
54 | { | ||
55 | int ret = 0; | ||
56 | /* | ||
57 | * copy data from application/kernel by pulling it out | ||
58 | * of the iovec. | ||
59 | */ | ||
60 | |||
61 | |||
62 | if (total_size) { | ||
63 | ret = orangefs_bufmap_copy_from_iovec(iter, | ||
64 | buffer_index, | ||
65 | total_size); | ||
66 | if (ret < 0) | ||
67 | gossip_err("%s: Failed to copy-in buffers. Please make sure that the pvfs2-client is running. %ld\n", | ||
68 | __func__, | ||
69 | (long)ret); | ||
70 | } | ||
71 | |||
72 | if (ret < 0) | ||
73 | gossip_err("%s: Failed to copy-in buffers. Please make sure that the pvfs2-client is running. %ld\n", | ||
74 | __func__, | ||
75 | (long)ret); | ||
76 | return ret; | ||
77 | } | ||
78 | |||
79 | /* | ||
80 | * Copy from client-core's address space to the buffers specified | ||
81 | * by the iovec upto total_size bytes. | ||
82 | * NOTE: the iovector can either contain addresses which | ||
83 | * can futher be kernel-space or user-space addresses. | ||
84 | * or it can pointers to struct page's | ||
85 | */ | ||
86 | static int postcopy_buffers(int buffer_index, | ||
87 | struct iov_iter *iter, | ||
88 | size_t total_size) | ||
89 | { | ||
90 | int ret = 0; | ||
91 | /* | ||
92 | * copy data to application/kernel by pushing it out to | ||
93 | * the iovec. NOTE; target buffers can be addresses or | ||
94 | * struct page pointers. | ||
95 | */ | ||
96 | if (total_size) { | ||
97 | ret = orangefs_bufmap_copy_to_iovec(iter, | ||
98 | buffer_index, | ||
99 | total_size); | ||
100 | if (ret < 0) | ||
101 | gossip_err("%s: Failed to copy-out buffers. Please make sure that the pvfs2-client is running (%ld)\n", | ||
102 | __func__, | ||
103 | (long)ret); | ||
104 | } | ||
105 | return ret; | ||
106 | } | ||
107 | |||
108 | /* | ||
109 | * Post and wait for the I/O upcall to finish | 45 | * Post and wait for the I/O upcall to finish |
110 | */ | 46 | */ |
111 | static ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inode, | 47 | static ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inode, |
@@ -157,14 +93,15 @@ populate_shared_memory: | |||
157 | total_size); | 93 | total_size); |
158 | /* | 94 | /* |
159 | * Stage 1: copy the buffers into client-core's address space | 95 | * Stage 1: copy the buffers into client-core's address space |
160 | * precopy_buffers only pertains to writes. | ||
161 | */ | 96 | */ |
162 | if (type == ORANGEFS_IO_WRITE) { | 97 | if (type == ORANGEFS_IO_WRITE && total_size) { |
163 | ret = precopy_buffers(buffer_index, | 98 | ret = orangefs_bufmap_copy_from_iovec(iter, buffer_index, |
164 | iter, | 99 | total_size); |
165 | total_size); | 100 | if (ret < 0) { |
166 | if (ret < 0) | 101 | gossip_err("%s: Failed to copy-in buffers. Please make sure that the pvfs2-client is running. %ld\n", |
102 | __func__, (long)ret); | ||
167 | goto out; | 103 | goto out; |
104 | } | ||
168 | } | 105 | } |
169 | 106 | ||
170 | gossip_debug(GOSSIP_FILE_DEBUG, | 107 | gossip_debug(GOSSIP_FILE_DEBUG, |
@@ -260,14 +197,20 @@ populate_shared_memory: | |||
260 | 197 | ||
261 | /* | 198 | /* |
262 | * Stage 3: Post copy buffers from client-core's address space | 199 | * Stage 3: Post copy buffers from client-core's address space |
263 | * postcopy_buffers only pertains to reads. | ||
264 | */ | 200 | */ |
265 | if (type == ORANGEFS_IO_READ) { | 201 | if (type == ORANGEFS_IO_READ && new_op->downcall.resp.io.amt_complete) { |
266 | ret = postcopy_buffers(buffer_index, | 202 | /* |
267 | iter, | 203 | * NOTE: the iovector can either contain addresses which |
268 | new_op->downcall.resp.io.amt_complete); | 204 | * can futher be kernel-space or user-space addresses. |
269 | if (ret < 0) | 205 | * or it can pointers to struct page's |
206 | */ | ||
207 | ret = orangefs_bufmap_copy_to_iovec(iter, buffer_index, | ||
208 | new_op->downcall.resp.io.amt_complete); | ||
209 | if (ret < 0) { | ||
210 | gossip_err("%s: Failed to copy-out buffers. Please make sure that the pvfs2-client is running (%ld)\n", | ||
211 | __func__, (long)ret); | ||
270 | goto out; | 212 | goto out; |
213 | } | ||
271 | } | 214 | } |
272 | gossip_debug(GOSSIP_FILE_DEBUG, | 215 | gossip_debug(GOSSIP_FILE_DEBUG, |
273 | "%s(%pU): Amount %s, returned by the sys-io call:%d\n", | 216 | "%s(%pU): Amount %s, returned by the sys-io call:%d\n", |