@@ -41,70 +41,6 @@ static int flush_racache(struct inode *inode)
41
41
return ret ;
42
42
}
43
43
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
44
/*
109
45
* Post and wait for the I/O upcall to finish
110
46
*/
@@ -157,14 +93,15 @@ static ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inod
157
93
total_size );
158
94
/*
159
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 ) {
163
- ret = precopy_buffers (buffer_index ,
164
- iter ,
165
- total_size );
166
- if (ret < 0 )
97
+ if (type == ORANGEFS_IO_WRITE && total_size ) {
98
+ ret = orangefs_bufmap_copy_from_iovec (iter , buffer_index ,
99
+ total_size );
100
+ 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
103
goto out ;
104
+ }
168
105
}
169
106
170
107
gossip_debug (GOSSIP_FILE_DEBUG ,
@@ -260,14 +197,20 @@ static ssize_t wait_for_direct_io(enum ORANGEFS_io_type type, struct inode *inod
260
197
261
198
/*
262
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 ) {
266
- ret = postcopy_buffers (buffer_index ,
267
- iter ,
268
- new_op -> downcall .resp .io .amt_complete );
269
- if (ret < 0 )
201
+ if (type == ORANGEFS_IO_READ && new_op -> downcall .resp .io .amt_complete ) {
202
+ /*
203
+ * NOTE: the iovector can either contain addresses which
204
+ * can futher be kernel-space or user-space addresses.
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
212
goto out ;
213
+ }
271
214
}
272
215
gossip_debug (GOSSIP_FILE_DEBUG ,
273
216
"%s(%pU): Amount %s, returned by the sys-io call:%d\n" ,
0 commit comments