diff options
-rw-r--r-- | fs/aio.c | 30 | ||||
-rw-r--r-- | fs/bio-integrity.c | 10 | ||||
-rw-r--r-- | fs/exec.c | 4 | ||||
-rw-r--r-- | fs/namei.c | 4 | ||||
-rw-r--r-- | fs/pipe.c | 8 | ||||
-rw-r--r-- | fs/splice.c | 7 | ||||
-rw-r--r-- | include/linux/bio.h | 8 |
7 files changed, 34 insertions, 37 deletions
@@ -160,7 +160,7 @@ static int aio_setup_ring(struct kioctx *ctx) | |||
160 | 160 | ||
161 | info->nr = nr_events; /* trusted copy */ | 161 | info->nr = nr_events; /* trusted copy */ |
162 | 162 | ||
163 | ring = kmap_atomic(info->ring_pages[0], KM_USER0); | 163 | ring = kmap_atomic(info->ring_pages[0]); |
164 | ring->nr = nr_events; /* user copy */ | 164 | ring->nr = nr_events; /* user copy */ |
165 | ring->id = ctx->user_id; | 165 | ring->id = ctx->user_id; |
166 | ring->head = ring->tail = 0; | 166 | ring->head = ring->tail = 0; |
@@ -168,32 +168,32 @@ static int aio_setup_ring(struct kioctx *ctx) | |||
168 | ring->compat_features = AIO_RING_COMPAT_FEATURES; | 168 | ring->compat_features = AIO_RING_COMPAT_FEATURES; |
169 | ring->incompat_features = AIO_RING_INCOMPAT_FEATURES; | 169 | ring->incompat_features = AIO_RING_INCOMPAT_FEATURES; |
170 | ring->header_length = sizeof(struct aio_ring); | 170 | ring->header_length = sizeof(struct aio_ring); |
171 | kunmap_atomic(ring, KM_USER0); | 171 | kunmap_atomic(ring); |
172 | 172 | ||
173 | return 0; | 173 | return 0; |
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | /* aio_ring_event: returns a pointer to the event at the given index from | 177 | /* aio_ring_event: returns a pointer to the event at the given index from |
178 | * kmap_atomic(, km). Release the pointer with put_aio_ring_event(); | 178 | * kmap_atomic(). Release the pointer with put_aio_ring_event(); |
179 | */ | 179 | */ |
180 | #define AIO_EVENTS_PER_PAGE (PAGE_SIZE / sizeof(struct io_event)) | 180 | #define AIO_EVENTS_PER_PAGE (PAGE_SIZE / sizeof(struct io_event)) |
181 | #define AIO_EVENTS_FIRST_PAGE ((PAGE_SIZE - sizeof(struct aio_ring)) / sizeof(struct io_event)) | 181 | #define AIO_EVENTS_FIRST_PAGE ((PAGE_SIZE - sizeof(struct aio_ring)) / sizeof(struct io_event)) |
182 | #define AIO_EVENTS_OFFSET (AIO_EVENTS_PER_PAGE - AIO_EVENTS_FIRST_PAGE) | 182 | #define AIO_EVENTS_OFFSET (AIO_EVENTS_PER_PAGE - AIO_EVENTS_FIRST_PAGE) |
183 | 183 | ||
184 | #define aio_ring_event(info, nr, km) ({ \ | 184 | #define aio_ring_event(info, nr) ({ \ |
185 | unsigned pos = (nr) + AIO_EVENTS_OFFSET; \ | 185 | unsigned pos = (nr) + AIO_EVENTS_OFFSET; \ |
186 | struct io_event *__event; \ | 186 | struct io_event *__event; \ |
187 | __event = kmap_atomic( \ | 187 | __event = kmap_atomic( \ |
188 | (info)->ring_pages[pos / AIO_EVENTS_PER_PAGE], km); \ | 188 | (info)->ring_pages[pos / AIO_EVENTS_PER_PAGE]); \ |
189 | __event += pos % AIO_EVENTS_PER_PAGE; \ | 189 | __event += pos % AIO_EVENTS_PER_PAGE; \ |
190 | __event; \ | 190 | __event; \ |
191 | }) | 191 | }) |
192 | 192 | ||
193 | #define put_aio_ring_event(event, km) do { \ | 193 | #define put_aio_ring_event(event) do { \ |
194 | struct io_event *__event = (event); \ | 194 | struct io_event *__event = (event); \ |
195 | (void)__event; \ | 195 | (void)__event; \ |
196 | kunmap_atomic((void *)((unsigned long)__event & PAGE_MASK), km); \ | 196 | kunmap_atomic((void *)((unsigned long)__event & PAGE_MASK)); \ |
197 | } while(0) | 197 | } while(0) |
198 | 198 | ||
199 | static void ctx_rcu_free(struct rcu_head *head) | 199 | static void ctx_rcu_free(struct rcu_head *head) |
@@ -1019,10 +1019,10 @@ int aio_complete(struct kiocb *iocb, long res, long res2) | |||
1019 | if (kiocbIsCancelled(iocb)) | 1019 | if (kiocbIsCancelled(iocb)) |
1020 | goto put_rq; | 1020 | goto put_rq; |
1021 | 1021 | ||
1022 | ring = kmap_atomic(info->ring_pages[0], KM_IRQ1); | 1022 | ring = kmap_atomic(info->ring_pages[0]); |
1023 | 1023 | ||
1024 | tail = info->tail; | 1024 | tail = info->tail; |
1025 | event = aio_ring_event(info, tail, KM_IRQ0); | 1025 | event = aio_ring_event(info, tail); |
1026 | if (++tail >= info->nr) | 1026 | if (++tail >= info->nr) |
1027 | tail = 0; | 1027 | tail = 0; |
1028 | 1028 | ||
@@ -1043,8 +1043,8 @@ int aio_complete(struct kiocb *iocb, long res, long res2) | |||
1043 | info->tail = tail; | 1043 | info->tail = tail; |
1044 | ring->tail = tail; | 1044 | ring->tail = tail; |
1045 | 1045 | ||
1046 | put_aio_ring_event(event, KM_IRQ0); | 1046 | put_aio_ring_event(event); |
1047 | kunmap_atomic(ring, KM_IRQ1); | 1047 | kunmap_atomic(ring); |
1048 | 1048 | ||
1049 | pr_debug("added to ring %p at [%lu]\n", iocb, tail); | 1049 | pr_debug("added to ring %p at [%lu]\n", iocb, tail); |
1050 | 1050 | ||
@@ -1089,7 +1089,7 @@ static int aio_read_evt(struct kioctx *ioctx, struct io_event *ent) | |||
1089 | unsigned long head; | 1089 | unsigned long head; |
1090 | int ret = 0; | 1090 | int ret = 0; |
1091 | 1091 | ||
1092 | ring = kmap_atomic(info->ring_pages[0], KM_USER0); | 1092 | ring = kmap_atomic(info->ring_pages[0]); |
1093 | dprintk("in aio_read_evt h%lu t%lu m%lu\n", | 1093 | dprintk("in aio_read_evt h%lu t%lu m%lu\n", |
1094 | (unsigned long)ring->head, (unsigned long)ring->tail, | 1094 | (unsigned long)ring->head, (unsigned long)ring->tail, |
1095 | (unsigned long)ring->nr); | 1095 | (unsigned long)ring->nr); |
@@ -1101,18 +1101,18 @@ static int aio_read_evt(struct kioctx *ioctx, struct io_event *ent) | |||
1101 | 1101 | ||
1102 | head = ring->head % info->nr; | 1102 | head = ring->head % info->nr; |
1103 | if (head != ring->tail) { | 1103 | if (head != ring->tail) { |
1104 | struct io_event *evp = aio_ring_event(info, head, KM_USER1); | 1104 | struct io_event *evp = aio_ring_event(info, head); |
1105 | *ent = *evp; | 1105 | *ent = *evp; |
1106 | head = (head + 1) % info->nr; | 1106 | head = (head + 1) % info->nr; |
1107 | smp_mb(); /* finish reading the event before updatng the head */ | 1107 | smp_mb(); /* finish reading the event before updatng the head */ |
1108 | ring->head = head; | 1108 | ring->head = head; |
1109 | ret = 1; | 1109 | ret = 1; |
1110 | put_aio_ring_event(evp, KM_USER1); | 1110 | put_aio_ring_event(evp); |
1111 | } | 1111 | } |
1112 | spin_unlock(&info->ring_lock); | 1112 | spin_unlock(&info->ring_lock); |
1113 | 1113 | ||
1114 | out: | 1114 | out: |
1115 | kunmap_atomic(ring, KM_USER0); | 1115 | kunmap_atomic(ring); |
1116 | dprintk("leaving aio_read_evt: %d h%lu t%lu\n", ret, | 1116 | dprintk("leaving aio_read_evt: %d h%lu t%lu\n", ret, |
1117 | (unsigned long)ring->head, (unsigned long)ring->tail); | 1117 | (unsigned long)ring->head, (unsigned long)ring->tail); |
1118 | return ret; | 1118 | return ret; |
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c index c2183f3917cd..e85c04b9f61c 100644 --- a/fs/bio-integrity.c +++ b/fs/bio-integrity.c | |||
@@ -357,7 +357,7 @@ static void bio_integrity_generate(struct bio *bio) | |||
357 | bix.sector_size = bi->sector_size; | 357 | bix.sector_size = bi->sector_size; |
358 | 358 | ||
359 | bio_for_each_segment(bv, bio, i) { | 359 | bio_for_each_segment(bv, bio, i) { |
360 | void *kaddr = kmap_atomic(bv->bv_page, KM_USER0); | 360 | void *kaddr = kmap_atomic(bv->bv_page); |
361 | bix.data_buf = kaddr + bv->bv_offset; | 361 | bix.data_buf = kaddr + bv->bv_offset; |
362 | bix.data_size = bv->bv_len; | 362 | bix.data_size = bv->bv_len; |
363 | bix.prot_buf = prot_buf; | 363 | bix.prot_buf = prot_buf; |
@@ -371,7 +371,7 @@ static void bio_integrity_generate(struct bio *bio) | |||
371 | total += sectors * bi->tuple_size; | 371 | total += sectors * bi->tuple_size; |
372 | BUG_ON(total > bio->bi_integrity->bip_size); | 372 | BUG_ON(total > bio->bi_integrity->bip_size); |
373 | 373 | ||
374 | kunmap_atomic(kaddr, KM_USER0); | 374 | kunmap_atomic(kaddr); |
375 | } | 375 | } |
376 | } | 376 | } |
377 | 377 | ||
@@ -498,7 +498,7 @@ static int bio_integrity_verify(struct bio *bio) | |||
498 | bix.sector_size = bi->sector_size; | 498 | bix.sector_size = bi->sector_size; |
499 | 499 | ||
500 | bio_for_each_segment(bv, bio, i) { | 500 | bio_for_each_segment(bv, bio, i) { |
501 | void *kaddr = kmap_atomic(bv->bv_page, KM_USER0); | 501 | void *kaddr = kmap_atomic(bv->bv_page); |
502 | bix.data_buf = kaddr + bv->bv_offset; | 502 | bix.data_buf = kaddr + bv->bv_offset; |
503 | bix.data_size = bv->bv_len; | 503 | bix.data_size = bv->bv_len; |
504 | bix.prot_buf = prot_buf; | 504 | bix.prot_buf = prot_buf; |
@@ -507,7 +507,7 @@ static int bio_integrity_verify(struct bio *bio) | |||
507 | ret = bi->verify_fn(&bix); | 507 | ret = bi->verify_fn(&bix); |
508 | 508 | ||
509 | if (ret) { | 509 | if (ret) { |
510 | kunmap_atomic(kaddr, KM_USER0); | 510 | kunmap_atomic(kaddr); |
511 | return ret; | 511 | return ret; |
512 | } | 512 | } |
513 | 513 | ||
@@ -517,7 +517,7 @@ static int bio_integrity_verify(struct bio *bio) | |||
517 | total += sectors * bi->tuple_size; | 517 | total += sectors * bi->tuple_size; |
518 | BUG_ON(total > bio->bi_integrity->bip_size); | 518 | BUG_ON(total > bio->bi_integrity->bip_size); |
519 | 519 | ||
520 | kunmap_atomic(kaddr, KM_USER0); | 520 | kunmap_atomic(kaddr); |
521 | } | 521 | } |
522 | 522 | ||
523 | return ret; | 523 | return ret; |
@@ -1339,13 +1339,13 @@ int remove_arg_zero(struct linux_binprm *bprm) | |||
1339 | ret = -EFAULT; | 1339 | ret = -EFAULT; |
1340 | goto out; | 1340 | goto out; |
1341 | } | 1341 | } |
1342 | kaddr = kmap_atomic(page, KM_USER0); | 1342 | kaddr = kmap_atomic(page); |
1343 | 1343 | ||
1344 | for (; offset < PAGE_SIZE && kaddr[offset]; | 1344 | for (; offset < PAGE_SIZE && kaddr[offset]; |
1345 | offset++, bprm->p++) | 1345 | offset++, bprm->p++) |
1346 | ; | 1346 | ; |
1347 | 1347 | ||
1348 | kunmap_atomic(kaddr, KM_USER0); | 1348 | kunmap_atomic(kaddr); |
1349 | put_arg_page(page); | 1349 | put_arg_page(page); |
1350 | 1350 | ||
1351 | if (offset == PAGE_SIZE) | 1351 | if (offset == PAGE_SIZE) |
diff --git a/fs/namei.c b/fs/namei.c index 46ea9cc16647..d135da74ce04 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -3371,9 +3371,9 @@ retry: | |||
3371 | if (err) | 3371 | if (err) |
3372 | goto fail; | 3372 | goto fail; |
3373 | 3373 | ||
3374 | kaddr = kmap_atomic(page, KM_USER0); | 3374 | kaddr = kmap_atomic(page); |
3375 | memcpy(kaddr, symname, len-1); | 3375 | memcpy(kaddr, symname, len-1); |
3376 | kunmap_atomic(kaddr, KM_USER0); | 3376 | kunmap_atomic(kaddr); |
3377 | 3377 | ||
3378 | err = pagecache_write_end(NULL, mapping, 0, len-1, len-1, | 3378 | err = pagecache_write_end(NULL, mapping, 0, len-1, len-1, |
3379 | page, fsdata); | 3379 | page, fsdata); |
@@ -230,7 +230,7 @@ void *generic_pipe_buf_map(struct pipe_inode_info *pipe, | |||
230 | { | 230 | { |
231 | if (atomic) { | 231 | if (atomic) { |
232 | buf->flags |= PIPE_BUF_FLAG_ATOMIC; | 232 | buf->flags |= PIPE_BUF_FLAG_ATOMIC; |
233 | return kmap_atomic(buf->page, KM_USER0); | 233 | return kmap_atomic(buf->page); |
234 | } | 234 | } |
235 | 235 | ||
236 | return kmap(buf->page); | 236 | return kmap(buf->page); |
@@ -251,7 +251,7 @@ void generic_pipe_buf_unmap(struct pipe_inode_info *pipe, | |||
251 | { | 251 | { |
252 | if (buf->flags & PIPE_BUF_FLAG_ATOMIC) { | 252 | if (buf->flags & PIPE_BUF_FLAG_ATOMIC) { |
253 | buf->flags &= ~PIPE_BUF_FLAG_ATOMIC; | 253 | buf->flags &= ~PIPE_BUF_FLAG_ATOMIC; |
254 | kunmap_atomic(map_data, KM_USER0); | 254 | kunmap_atomic(map_data); |
255 | } else | 255 | } else |
256 | kunmap(buf->page); | 256 | kunmap(buf->page); |
257 | } | 257 | } |
@@ -565,14 +565,14 @@ redo1: | |||
565 | iov_fault_in_pages_read(iov, chars); | 565 | iov_fault_in_pages_read(iov, chars); |
566 | redo2: | 566 | redo2: |
567 | if (atomic) | 567 | if (atomic) |
568 | src = kmap_atomic(page, KM_USER0); | 568 | src = kmap_atomic(page); |
569 | else | 569 | else |
570 | src = kmap(page); | 570 | src = kmap(page); |
571 | 571 | ||
572 | error = pipe_iov_copy_from_user(src, iov, chars, | 572 | error = pipe_iov_copy_from_user(src, iov, chars, |
573 | atomic); | 573 | atomic); |
574 | if (atomic) | 574 | if (atomic) |
575 | kunmap_atomic(src, KM_USER0); | 575 | kunmap_atomic(src); |
576 | else | 576 | else |
577 | kunmap(page); | 577 | kunmap(page); |
578 | 578 | ||
diff --git a/fs/splice.c b/fs/splice.c index 1ec0493266b3..f16402ed915c 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -737,15 +737,12 @@ int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf, | |||
737 | goto out; | 737 | goto out; |
738 | 738 | ||
739 | if (buf->page != page) { | 739 | if (buf->page != page) { |
740 | /* | ||
741 | * Careful, ->map() uses KM_USER0! | ||
742 | */ | ||
743 | char *src = buf->ops->map(pipe, buf, 1); | 740 | char *src = buf->ops->map(pipe, buf, 1); |
744 | char *dst = kmap_atomic(page, KM_USER1); | 741 | char *dst = kmap_atomic(page); |
745 | 742 | ||
746 | memcpy(dst + offset, src + buf->offset, this_len); | 743 | memcpy(dst + offset, src + buf->offset, this_len); |
747 | flush_dcache_page(page); | 744 | flush_dcache_page(page); |
748 | kunmap_atomic(dst, KM_USER1); | 745 | kunmap_atomic(dst); |
749 | buf->ops->unmap(pipe, buf, src); | 746 | buf->ops->unmap(pipe, buf, src); |
750 | } | 747 | } |
751 | ret = pagecache_write_end(file, mapping, sd->pos, this_len, this_len, | 748 | ret = pagecache_write_end(file, mapping, sd->pos, this_len, this_len, |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 129a9c097958..de5422a57511 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -101,10 +101,10 @@ static inline int bio_has_allocated_vec(struct bio *bio) | |||
101 | * I/O completely on that queue (see ide-dma for example) | 101 | * I/O completely on that queue (see ide-dma for example) |
102 | */ | 102 | */ |
103 | #define __bio_kmap_atomic(bio, idx, kmtype) \ | 103 | #define __bio_kmap_atomic(bio, idx, kmtype) \ |
104 | (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page, kmtype) + \ | 104 | (kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page) + \ |
105 | bio_iovec_idx((bio), (idx))->bv_offset) | 105 | bio_iovec_idx((bio), (idx))->bv_offset) |
106 | 106 | ||
107 | #define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr, kmtype) | 107 | #define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr) |
108 | 108 | ||
109 | /* | 109 | /* |
110 | * merge helpers etc | 110 | * merge helpers etc |
@@ -317,7 +317,7 @@ static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags) | |||
317 | * balancing is a lot nicer this way | 317 | * balancing is a lot nicer this way |
318 | */ | 318 | */ |
319 | local_irq_save(*flags); | 319 | local_irq_save(*flags); |
320 | addr = (unsigned long) kmap_atomic(bvec->bv_page, KM_BIO_SRC_IRQ); | 320 | addr = (unsigned long) kmap_atomic(bvec->bv_page); |
321 | 321 | ||
322 | BUG_ON(addr & ~PAGE_MASK); | 322 | BUG_ON(addr & ~PAGE_MASK); |
323 | 323 | ||
@@ -328,7 +328,7 @@ static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags) | |||
328 | { | 328 | { |
329 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; | 329 | unsigned long ptr = (unsigned long) buffer & PAGE_MASK; |
330 | 330 | ||
331 | kunmap_atomic((void *) ptr, KM_BIO_SRC_IRQ); | 331 | kunmap_atomic((void *) ptr); |
332 | local_irq_restore(*flags); | 332 | local_irq_restore(*flags); |
333 | } | 333 | } |
334 | 334 | ||