@@ -399,7 +399,7 @@ int zstd_compress_pages(struct list_head *ws, struct address_space *mapping,
399
399
400
400
/* map in the first page of input data */
401
401
in_page = find_get_page (mapping , start >> PAGE_SHIFT );
402
- workspace -> in_buf .src = kmap (in_page );
402
+ workspace -> in_buf .src = page_address (in_page );
403
403
workspace -> in_buf .pos = 0 ;
404
404
workspace -> in_buf .size = min_t (size_t , len , PAGE_SIZE );
405
405
@@ -411,7 +411,7 @@ int zstd_compress_pages(struct list_head *ws, struct address_space *mapping,
411
411
goto out ;
412
412
}
413
413
pages [nr_pages ++ ] = out_page ;
414
- workspace -> out_buf .dst = kmap (out_page );
414
+ workspace -> out_buf .dst = page_address (out_page );
415
415
workspace -> out_buf .pos = 0 ;
416
416
workspace -> out_buf .size = min_t (size_t , max_out , PAGE_SIZE );
417
417
@@ -446,7 +446,6 @@ int zstd_compress_pages(struct list_head *ws, struct address_space *mapping,
446
446
if (workspace -> out_buf .pos == workspace -> out_buf .size ) {
447
447
tot_out += PAGE_SIZE ;
448
448
max_out -= PAGE_SIZE ;
449
- kunmap (out_page );
450
449
if (nr_pages == nr_dest_pages ) {
451
450
out_page = NULL ;
452
451
ret = - E2BIG ;
@@ -458,7 +457,7 @@ int zstd_compress_pages(struct list_head *ws, struct address_space *mapping,
458
457
goto out ;
459
458
}
460
459
pages [nr_pages ++ ] = out_page ;
461
- workspace -> out_buf .dst = kmap (out_page );
460
+ workspace -> out_buf .dst = page_address (out_page );
462
461
workspace -> out_buf .pos = 0 ;
463
462
workspace -> out_buf .size = min_t (size_t , max_out ,
464
463
PAGE_SIZE );
@@ -473,13 +472,12 @@ int zstd_compress_pages(struct list_head *ws, struct address_space *mapping,
473
472
/* Check if we need more input */
474
473
if (workspace -> in_buf .pos == workspace -> in_buf .size ) {
475
474
tot_in += PAGE_SIZE ;
476
- kunmap (in_page );
477
475
put_page (in_page );
478
476
479
477
start += PAGE_SIZE ;
480
478
len -= PAGE_SIZE ;
481
479
in_page = find_get_page (mapping , start >> PAGE_SHIFT );
482
- workspace -> in_buf .src = kmap (in_page );
480
+ workspace -> in_buf .src = page_address (in_page );
483
481
workspace -> in_buf .pos = 0 ;
484
482
workspace -> in_buf .size = min_t (size_t , len , PAGE_SIZE );
485
483
}
@@ -506,7 +504,6 @@ int zstd_compress_pages(struct list_head *ws, struct address_space *mapping,
506
504
507
505
tot_out += PAGE_SIZE ;
508
506
max_out -= PAGE_SIZE ;
509
- kunmap (out_page );
510
507
if (nr_pages == nr_dest_pages ) {
511
508
out_page = NULL ;
512
509
ret = - E2BIG ;
@@ -518,7 +515,7 @@ int zstd_compress_pages(struct list_head *ws, struct address_space *mapping,
518
515
goto out ;
519
516
}
520
517
pages [nr_pages ++ ] = out_page ;
521
- workspace -> out_buf .dst = kmap (out_page );
518
+ workspace -> out_buf .dst = page_address (out_page );
522
519
workspace -> out_buf .pos = 0 ;
523
520
workspace -> out_buf .size = min_t (size_t , max_out , PAGE_SIZE );
524
521
}
@@ -534,12 +531,8 @@ int zstd_compress_pages(struct list_head *ws, struct address_space *mapping,
534
531
out :
535
532
* out_pages = nr_pages ;
536
533
/* Cleanup */
537
- if (in_page ) {
538
- kunmap (in_page );
534
+ if (in_page )
539
535
put_page (in_page );
540
- }
541
- if (out_page )
542
- kunmap (out_page );
543
536
return ret ;
544
537
}
545
538
@@ -565,7 +558,7 @@ int zstd_decompress_bio(struct list_head *ws, struct compressed_bio *cb)
565
558
goto done ;
566
559
}
567
560
568
- workspace -> in_buf .src = kmap (pages_in [page_in_index ]);
561
+ workspace -> in_buf .src = page_address (pages_in [page_in_index ]);
569
562
workspace -> in_buf .pos = 0 ;
570
563
workspace -> in_buf .size = min_t (size_t , srclen , PAGE_SIZE );
571
564
@@ -601,23 +594,21 @@ int zstd_decompress_bio(struct list_head *ws, struct compressed_bio *cb)
601
594
break ;
602
595
603
596
if (workspace -> in_buf .pos == workspace -> in_buf .size ) {
604
- kunmap ( pages_in [ page_in_index ++ ]) ;
597
+ page_in_index ++ ;
605
598
if (page_in_index >= total_pages_in ) {
606
599
workspace -> in_buf .src = NULL ;
607
600
ret = - EIO ;
608
601
goto done ;
609
602
}
610
603
srclen -= PAGE_SIZE ;
611
- workspace -> in_buf .src = kmap (pages_in [page_in_index ]);
604
+ workspace -> in_buf .src = page_address (pages_in [page_in_index ]);
612
605
workspace -> in_buf .pos = 0 ;
613
606
workspace -> in_buf .size = min_t (size_t , srclen , PAGE_SIZE );
614
607
}
615
608
}
616
609
ret = 0 ;
617
610
zero_fill_bio (orig_bio );
618
611
done :
619
- if (workspace -> in_buf .src )
620
- kunmap (pages_in [page_in_index ]);
621
612
return ret ;
622
613
}
623
614
0 commit comments