@@ -154,10 +154,9 @@ int bio_integrity_add_page(struct bio *bio, struct page *page,
154
154
EXPORT_SYMBOL (bio_integrity_add_page );
155
155
156
156
static int bio_integrity_copy_user (struct bio * bio , struct bio_vec * bvec ,
157
- int nr_vecs , unsigned int len ,
158
- unsigned int direction )
157
+ int nr_vecs , unsigned int len )
159
158
{
160
- bool write = direction == ITER_SOURCE ;
159
+ bool write = op_is_write ( bio_op ( bio )) ;
161
160
struct bio_integrity_payload * bip ;
162
161
struct iov_iter iter ;
163
162
void * buf ;
@@ -168,7 +167,7 @@ static int bio_integrity_copy_user(struct bio *bio, struct bio_vec *bvec,
168
167
return - ENOMEM ;
169
168
170
169
if (write ) {
171
- iov_iter_bvec (& iter , direction , bvec , nr_vecs , len );
170
+ iov_iter_bvec (& iter , ITER_SOURCE , bvec , nr_vecs , len );
172
171
if (!copy_from_iter_full (buf , len , & iter )) {
173
172
ret = - EFAULT ;
174
173
goto free_buf ;
@@ -264,7 +263,7 @@ int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter)
264
263
struct page * stack_pages [UIO_FASTIOV ], * * pages = stack_pages ;
265
264
struct bio_vec stack_vec [UIO_FASTIOV ], * bvec = stack_vec ;
266
265
size_t offset , bytes = iter -> count ;
267
- unsigned int direction , nr_bvecs ;
266
+ unsigned int nr_bvecs ;
268
267
int ret , nr_vecs ;
269
268
bool copy ;
270
269
@@ -273,11 +272,6 @@ int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter)
273
272
if (bytes >> SECTOR_SHIFT > queue_max_hw_sectors (q ))
274
273
return - E2BIG ;
275
274
276
- if (bio_data_dir (bio ) == READ )
277
- direction = ITER_DEST ;
278
- else
279
- direction = ITER_SOURCE ;
280
-
281
275
nr_vecs = iov_iter_npages (iter , BIO_MAX_VECS + 1 );
282
276
if (nr_vecs > BIO_MAX_VECS )
283
277
return - E2BIG ;
@@ -300,8 +294,7 @@ int bio_integrity_map_user(struct bio *bio, struct iov_iter *iter)
300
294
copy = true;
301
295
302
296
if (copy )
303
- ret = bio_integrity_copy_user (bio , bvec , nr_bvecs , bytes ,
304
- direction );
297
+ ret = bio_integrity_copy_user (bio , bvec , nr_bvecs , bytes );
305
298
else
306
299
ret = bio_integrity_init_user (bio , bvec , nr_bvecs , bytes );
307
300
if (ret )
0 commit comments