Commit e8e3c3d66fd9d1ee2250f68d778cc48c1346d228

Authored by Cong Wang
Committed by Cong Wang
1 parent c6daa7ffa8

fs: remove the second argument of k[un]map_atomic()

Acked-by: Benjamin LaHaise <bcrl@kvack.org>
Signed-off-by: Cong Wang <amwang@redhat.com>

Showing 7 changed files with 34 additions and 37 deletions Side-by-side Diff

... ... @@ -160,7 +160,7 @@
160 160  
161 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 164 ring->nr = nr_events; /* user copy */
165 165 ring->id = ctx->user_id;
166 166 ring->head = ring->tail = 0;
167 167  
168 168  
169 169  
170 170  
171 171  
... ... @@ -168,32 +168,32 @@
168 168 ring->compat_features = AIO_RING_COMPAT_FEATURES;
169 169 ring->incompat_features = AIO_RING_INCOMPAT_FEATURES;
170 170 ring->header_length = sizeof(struct aio_ring);
171   - kunmap_atomic(ring, KM_USER0);
  171 + kunmap_atomic(ring);
172 172  
173 173 return 0;
174 174 }
175 175  
176 176  
177 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 180 #define AIO_EVENTS_PER_PAGE (PAGE_SIZE / sizeof(struct io_event))
181 181 #define AIO_EVENTS_FIRST_PAGE ((PAGE_SIZE - sizeof(struct aio_ring)) / sizeof(struct io_event))
182 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 185 unsigned pos = (nr) + AIO_EVENTS_OFFSET; \
186 186 struct io_event *__event; \
187 187 __event = kmap_atomic( \
188   - (info)->ring_pages[pos / AIO_EVENTS_PER_PAGE], km); \
  188 + (info)->ring_pages[pos / AIO_EVENTS_PER_PAGE]); \
189 189 __event += pos % AIO_EVENTS_PER_PAGE; \
190 190 __event; \
191 191 })
192 192  
193   -#define put_aio_ring_event(event, km) do { \
  193 +#define put_aio_ring_event(event) do { \
194 194 struct io_event *__event = (event); \
195 195 (void)__event; \
196   - kunmap_atomic((void *)((unsigned long)__event & PAGE_MASK), km); \
  196 + kunmap_atomic((void *)((unsigned long)__event & PAGE_MASK)); \
197 197 } while(0)
198 198  
199 199 static void ctx_rcu_free(struct rcu_head *head)
200 200  
... ... @@ -1019,10 +1019,10 @@
1019 1019 if (kiocbIsCancelled(iocb))
1020 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 1024 tail = info->tail;
1025   - event = aio_ring_event(info, tail, KM_IRQ0);
  1025 + event = aio_ring_event(info, tail);
1026 1026 if (++tail >= info->nr)
1027 1027 tail = 0;
1028 1028  
... ... @@ -1043,8 +1043,8 @@
1043 1043 info->tail = tail;
1044 1044 ring->tail = tail;
1045 1045  
1046   - put_aio_ring_event(event, KM_IRQ0);
1047   - kunmap_atomic(ring, KM_IRQ1);
  1046 + put_aio_ring_event(event);
  1047 + kunmap_atomic(ring);
1048 1048  
1049 1049 pr_debug("added to ring %p at [%lu]\n", iocb, tail);
1050 1050  
... ... @@ -1089,7 +1089,7 @@
1089 1089 unsigned long head;
1090 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 1093 dprintk("in aio_read_evt h%lu t%lu m%lu\n",
1094 1094 (unsigned long)ring->head, (unsigned long)ring->tail,
1095 1095 (unsigned long)ring->nr);
1096 1096  
1097 1097  
... ... @@ -1101,18 +1101,18 @@
1101 1101  
1102 1102 head = ring->head % info->nr;
1103 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 1105 *ent = *evp;
1106 1106 head = (head + 1) % info->nr;
1107 1107 smp_mb(); /* finish reading the event before updatng the head */
1108 1108 ring->head = head;
1109 1109 ret = 1;
1110   - put_aio_ring_event(evp, KM_USER1);
  1110 + put_aio_ring_event(evp);
1111 1111 }
1112 1112 spin_unlock(&info->ring_lock);
1113 1113  
1114 1114 out:
1115   - kunmap_atomic(ring, KM_USER0);
  1115 + kunmap_atomic(ring);
1116 1116 dprintk("leaving aio_read_evt: %d h%lu t%lu\n", ret,
1117 1117 (unsigned long)ring->head, (unsigned long)ring->tail);
1118 1118 return ret;
... ... @@ -357,7 +357,7 @@
357 357 bix.sector_size = bi->sector_size;
358 358  
359 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 361 bix.data_buf = kaddr + bv->bv_offset;
362 362 bix.data_size = bv->bv_len;
363 363 bix.prot_buf = prot_buf;
... ... @@ -371,7 +371,7 @@
371 371 total += sectors * bi->tuple_size;
372 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 @@
498 498 bix.sector_size = bi->sector_size;
499 499  
500 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 502 bix.data_buf = kaddr + bv->bv_offset;
503 503 bix.data_size = bv->bv_len;
504 504 bix.prot_buf = prot_buf;
... ... @@ -507,7 +507,7 @@
507 507 ret = bi->verify_fn(&bix);
508 508  
509 509 if (ret) {
510   - kunmap_atomic(kaddr, KM_USER0);
  510 + kunmap_atomic(kaddr);
511 511 return ret;
512 512 }
513 513  
... ... @@ -517,7 +517,7 @@
517 517 total += sectors * bi->tuple_size;
518 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 523 return ret;
... ... @@ -1339,13 +1339,13 @@
1339 1339 ret = -EFAULT;
1340 1340 goto out;
1341 1341 }
1342   - kaddr = kmap_atomic(page, KM_USER0);
  1342 + kaddr = kmap_atomic(page);
1343 1343  
1344 1344 for (; offset < PAGE_SIZE && kaddr[offset];
1345 1345 offset++, bprm->p++)
1346 1346 ;
1347 1347  
1348   - kunmap_atomic(kaddr, KM_USER0);
  1348 + kunmap_atomic(kaddr);
1349 1349 put_arg_page(page);
1350 1350  
1351 1351 if (offset == PAGE_SIZE)
... ... @@ -3371,9 +3371,9 @@
3371 3371 if (err)
3372 3372 goto fail;
3373 3373  
3374   - kaddr = kmap_atomic(page, KM_USER0);
  3374 + kaddr = kmap_atomic(page);
3375 3375 memcpy(kaddr, symname, len-1);
3376   - kunmap_atomic(kaddr, KM_USER0);
  3376 + kunmap_atomic(kaddr);
3377 3377  
3378 3378 err = pagecache_write_end(NULL, mapping, 0, len-1, len-1,
3379 3379 page, fsdata);
... ... @@ -230,7 +230,7 @@
230 230 {
231 231 if (atomic) {
232 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 236 return kmap(buf->page);
... ... @@ -251,7 +251,7 @@
251 251 {
252 252 if (buf->flags & PIPE_BUF_FLAG_ATOMIC) {
253 253 buf->flags &= ~PIPE_BUF_FLAG_ATOMIC;
254   - kunmap_atomic(map_data, KM_USER0);
  254 + kunmap_atomic(map_data);
255 255 } else
256 256 kunmap(buf->page);
257 257 }
258 258  
... ... @@ -565,14 +565,14 @@
565 565 iov_fault_in_pages_read(iov, chars);
566 566 redo2:
567 567 if (atomic)
568   - src = kmap_atomic(page, KM_USER0);
  568 + src = kmap_atomic(page);
569 569 else
570 570 src = kmap(page);
571 571  
572 572 error = pipe_iov_copy_from_user(src, iov, chars,
573 573 atomic);
574 574 if (atomic)
575   - kunmap_atomic(src, KM_USER0);
  575 + kunmap_atomic(src);
576 576 else
577 577 kunmap(page);
578 578  
... ... @@ -737,15 +737,12 @@
737 737 goto out;
738 738  
739 739 if (buf->page != page) {
740   - /*
741   - * Careful, ->map() uses KM_USER0!
742   - */
743 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 743 memcpy(dst + offset, src + buf->offset, this_len);
747 744 flush_dcache_page(page);
748   - kunmap_atomic(dst, KM_USER1);
  745 + kunmap_atomic(dst);
749 746 buf->ops->unmap(pipe, buf, src);
750 747 }
751 748 ret = pagecache_write_end(file, mapping, sd->pos, this_len, this_len,
... ... @@ -101,10 +101,10 @@
101 101 * I/O completely on that queue (see ide-dma for example)
102 102 */
103 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 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 110 * merge helpers etc
... ... @@ -317,7 +317,7 @@
317 317 * balancing is a lot nicer this way
318 318 */
319 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 322 BUG_ON(addr & ~PAGE_MASK);
323 323  
... ... @@ -328,7 +328,7 @@
328 328 {
329 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 332 local_irq_restore(*flags);
333 333 }
334 334