diff options
Diffstat (limited to 'fs/dax.c')
-rw-r--r-- | fs/dax.c | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -323,7 +323,7 @@ static int dax_load_hole(struct address_space *mapping, struct page *page, | |||
323 | size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT; | 323 | size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT; |
324 | if (vmf->pgoff >= size) { | 324 | if (vmf->pgoff >= size) { |
325 | unlock_page(page); | 325 | unlock_page(page); |
326 | page_cache_release(page); | 326 | put_page(page); |
327 | return VM_FAULT_SIGBUS; | 327 | return VM_FAULT_SIGBUS; |
328 | } | 328 | } |
329 | 329 | ||
@@ -351,7 +351,7 @@ static int copy_user_bh(struct page *to, struct inode *inode, | |||
351 | } | 351 | } |
352 | 352 | ||
353 | #define NO_SECTOR -1 | 353 | #define NO_SECTOR -1 |
354 | #define DAX_PMD_INDEX(page_index) (page_index & (PMD_MASK >> PAGE_CACHE_SHIFT)) | 354 | #define DAX_PMD_INDEX(page_index) (page_index & (PMD_MASK >> PAGE_SHIFT)) |
355 | 355 | ||
356 | static int dax_radix_entry(struct address_space *mapping, pgoff_t index, | 356 | static int dax_radix_entry(struct address_space *mapping, pgoff_t index, |
357 | sector_t sector, bool pmd_entry, bool dirty) | 357 | sector_t sector, bool pmd_entry, bool dirty) |
@@ -506,8 +506,8 @@ int dax_writeback_mapping_range(struct address_space *mapping, | |||
506 | if (!mapping->nrexceptional || wbc->sync_mode != WB_SYNC_ALL) | 506 | if (!mapping->nrexceptional || wbc->sync_mode != WB_SYNC_ALL) |
507 | return 0; | 507 | return 0; |
508 | 508 | ||
509 | start_index = wbc->range_start >> PAGE_CACHE_SHIFT; | 509 | start_index = wbc->range_start >> PAGE_SHIFT; |
510 | end_index = wbc->range_end >> PAGE_CACHE_SHIFT; | 510 | end_index = wbc->range_end >> PAGE_SHIFT; |
511 | pmd_index = DAX_PMD_INDEX(start_index); | 511 | pmd_index = DAX_PMD_INDEX(start_index); |
512 | 512 | ||
513 | rcu_read_lock(); | 513 | rcu_read_lock(); |
@@ -642,12 +642,12 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
642 | page = find_get_page(mapping, vmf->pgoff); | 642 | page = find_get_page(mapping, vmf->pgoff); |
643 | if (page) { | 643 | if (page) { |
644 | if (!lock_page_or_retry(page, vma->vm_mm, vmf->flags)) { | 644 | if (!lock_page_or_retry(page, vma->vm_mm, vmf->flags)) { |
645 | page_cache_release(page); | 645 | put_page(page); |
646 | return VM_FAULT_RETRY; | 646 | return VM_FAULT_RETRY; |
647 | } | 647 | } |
648 | if (unlikely(page->mapping != mapping)) { | 648 | if (unlikely(page->mapping != mapping)) { |
649 | unlock_page(page); | 649 | unlock_page(page); |
650 | page_cache_release(page); | 650 | put_page(page); |
651 | goto repeat; | 651 | goto repeat; |
652 | } | 652 | } |
653 | size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT; | 653 | size = (i_size_read(inode) + PAGE_SIZE - 1) >> PAGE_SHIFT; |
@@ -711,10 +711,10 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
711 | 711 | ||
712 | if (page) { | 712 | if (page) { |
713 | unmap_mapping_range(mapping, vmf->pgoff << PAGE_SHIFT, | 713 | unmap_mapping_range(mapping, vmf->pgoff << PAGE_SHIFT, |
714 | PAGE_CACHE_SIZE, 0); | 714 | PAGE_SIZE, 0); |
715 | delete_from_page_cache(page); | 715 | delete_from_page_cache(page); |
716 | unlock_page(page); | 716 | unlock_page(page); |
717 | page_cache_release(page); | 717 | put_page(page); |
718 | page = NULL; | 718 | page = NULL; |
719 | } | 719 | } |
720 | 720 | ||
@@ -747,7 +747,7 @@ int __dax_fault(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
747 | unlock_page: | 747 | unlock_page: |
748 | if (page) { | 748 | if (page) { |
749 | unlock_page(page); | 749 | unlock_page(page); |
750 | page_cache_release(page); | 750 | put_page(page); |
751 | } | 751 | } |
752 | goto out; | 752 | goto out; |
753 | } | 753 | } |
@@ -1094,7 +1094,7 @@ EXPORT_SYMBOL_GPL(dax_pfn_mkwrite); | |||
1094 | * you are truncating a file, the helper function dax_truncate_page() may be | 1094 | * you are truncating a file, the helper function dax_truncate_page() may be |
1095 | * more convenient. | 1095 | * more convenient. |
1096 | * | 1096 | * |
1097 | * We work in terms of PAGE_CACHE_SIZE here for commonality with | 1097 | * We work in terms of PAGE_SIZE here for commonality with |
1098 | * block_truncate_page(), but we could go down to PAGE_SIZE if the filesystem | 1098 | * block_truncate_page(), but we could go down to PAGE_SIZE if the filesystem |
1099 | * took care of disposing of the unnecessary blocks. Even if the filesystem | 1099 | * took care of disposing of the unnecessary blocks. Even if the filesystem |
1100 | * block size is smaller than PAGE_SIZE, we have to zero the rest of the page | 1100 | * block size is smaller than PAGE_SIZE, we have to zero the rest of the page |
@@ -1104,18 +1104,18 @@ int dax_zero_page_range(struct inode *inode, loff_t from, unsigned length, | |||
1104 | get_block_t get_block) | 1104 | get_block_t get_block) |
1105 | { | 1105 | { |
1106 | struct buffer_head bh; | 1106 | struct buffer_head bh; |
1107 | pgoff_t index = from >> PAGE_CACHE_SHIFT; | 1107 | pgoff_t index = from >> PAGE_SHIFT; |
1108 | unsigned offset = from & (PAGE_CACHE_SIZE-1); | 1108 | unsigned offset = from & (PAGE_SIZE-1); |
1109 | int err; | 1109 | int err; |
1110 | 1110 | ||
1111 | /* Block boundary? Nothing to do */ | 1111 | /* Block boundary? Nothing to do */ |
1112 | if (!length) | 1112 | if (!length) |
1113 | return 0; | 1113 | return 0; |
1114 | BUG_ON((offset + length) > PAGE_CACHE_SIZE); | 1114 | BUG_ON((offset + length) > PAGE_SIZE); |
1115 | 1115 | ||
1116 | memset(&bh, 0, sizeof(bh)); | 1116 | memset(&bh, 0, sizeof(bh)); |
1117 | bh.b_bdev = inode->i_sb->s_bdev; | 1117 | bh.b_bdev = inode->i_sb->s_bdev; |
1118 | bh.b_size = PAGE_CACHE_SIZE; | 1118 | bh.b_size = PAGE_SIZE; |
1119 | err = get_block(inode, index, &bh, 0); | 1119 | err = get_block(inode, index, &bh, 0); |
1120 | if (err < 0) | 1120 | if (err < 0) |
1121 | return err; | 1121 | return err; |
@@ -1123,7 +1123,7 @@ int dax_zero_page_range(struct inode *inode, loff_t from, unsigned length, | |||
1123 | struct block_device *bdev = bh.b_bdev; | 1123 | struct block_device *bdev = bh.b_bdev; |
1124 | struct blk_dax_ctl dax = { | 1124 | struct blk_dax_ctl dax = { |
1125 | .sector = to_sector(&bh, inode), | 1125 | .sector = to_sector(&bh, inode), |
1126 | .size = PAGE_CACHE_SIZE, | 1126 | .size = PAGE_SIZE, |
1127 | }; | 1127 | }; |
1128 | 1128 | ||
1129 | if (dax_map_atomic(bdev, &dax) < 0) | 1129 | if (dax_map_atomic(bdev, &dax) < 0) |
@@ -1146,7 +1146,7 @@ EXPORT_SYMBOL_GPL(dax_zero_page_range); | |||
1146 | * Similar to block_truncate_page(), this function can be called by a | 1146 | * Similar to block_truncate_page(), this function can be called by a |
1147 | * filesystem when it is truncating a DAX file to handle the partial page. | 1147 | * filesystem when it is truncating a DAX file to handle the partial page. |
1148 | * | 1148 | * |
1149 | * We work in terms of PAGE_CACHE_SIZE here for commonality with | 1149 | * We work in terms of PAGE_SIZE here for commonality with |
1150 | * block_truncate_page(), but we could go down to PAGE_SIZE if the filesystem | 1150 | * block_truncate_page(), but we could go down to PAGE_SIZE if the filesystem |
1151 | * took care of disposing of the unnecessary blocks. Even if the filesystem | 1151 | * took care of disposing of the unnecessary blocks. Even if the filesystem |
1152 | * block size is smaller than PAGE_SIZE, we have to zero the rest of the page | 1152 | * block size is smaller than PAGE_SIZE, we have to zero the rest of the page |
@@ -1154,7 +1154,7 @@ EXPORT_SYMBOL_GPL(dax_zero_page_range); | |||
1154 | */ | 1154 | */ |
1155 | int dax_truncate_page(struct inode *inode, loff_t from, get_block_t get_block) | 1155 | int dax_truncate_page(struct inode *inode, loff_t from, get_block_t get_block) |
1156 | { | 1156 | { |
1157 | unsigned length = PAGE_CACHE_ALIGN(from) - from; | 1157 | unsigned length = PAGE_ALIGN(from) - from; |
1158 | return dax_zero_page_range(inode, from, length, get_block); | 1158 | return dax_zero_page_range(inode, from, length, get_block); |
1159 | } | 1159 | } |
1160 | EXPORT_SYMBOL_GPL(dax_truncate_page); | 1160 | EXPORT_SYMBOL_GPL(dax_truncate_page); |