fs/ecryptfs: Replace kmap_atomic() with kmap_local_page()
PATCH 1/1 fs/ecryptfs: Replace kmap_atomic() with kmap_local_page()
kmap_atomic() is deprecated in favor of kmap_local_page(). Therefore, replace kmap_atomic() with kmap_local_page() in ecryptfs_write().
kmap_atomic() is implemented like a kmap_local_page() which also disables page-faults and preemption (the latter only for !PREEMPT_RT kernels).
The code within the mapping/un-mapping in ecryptfs_write() does not depend on the above-mentioned side effects.
Therefore, a mere replacement of the old API with the new one is all that is required (i.e., there is no need to explicitly add any calls to pagefault_disable() and/or preempt_disable()).
--- fs/ecryptfs/read_write.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ecryptfs/read_write.c +2 -2
@@ -140,7 +140,7 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset, ecryptfs_page_idx, rc); goto out; } - ecryptfs_page_virt =kmap_atomic (ecryptfs_page); + ecryptfs_page_virt =kmap_local_page (ecryptfs_page);/* * pos: where we're now writing, offset: where the request was
@@ -163,7 +163,7 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset, (data + data_offset), num_bytes); data_offset += num_bytes; } -kunmap_atomic (ecryptfs_page_virt); +kunmap_local (ecryptfs_page_virt);flush_dcache_page (ecryptfs_page);SetPageUptodate (ecryptfs_page);unlock_page (ecryptfs_page);
Signature · 1 line
2.39.0
Quoted 6 lines · Fabio M. De Francesco
kmap_atomic()is deprecated in favor ofkmap_local_page(). Therefore, replacekmap_atomic()withkmap_local_page()inecryptfs_write().
kmap_atomic()is implemented like akmap_local_page()which also disables page-faults and preemption (the latter only for !PREEMPT_RT kernels).
Quoted 8 lines
The code within the mapping/un-mapping in
ecryptfs_write()does not depend on the above-mentioned side effects.Therefore, a mere replacement of the old API with the new one is all that is required (i.e., there is no need to explicitly add any calls to
pagefault_disable()and/orpreempt_disable()).Suggested-by Ira Weiny <[email protected]>
Quoted 30 lines
Signed-off-by Fabio M. De Francesco <[email protected]>--- fs/ecryptfs/read_write.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/ecryptfs/read_write.c +2
-2@@ -140,7 +140,7 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset, ecryptfs_page_idx, rc); goto out; } - ecryptfs_page_virt =kmap_atomic (ecryptfs_page); + ecryptfs_page_virt =kmap_local_page (ecryptfs_page);/* * pos: where we're now writing, offset: where the request was @@ -163,7 +163,7 @@ int ecryptfs_write(struct inode *ecryptfs_inode, char *data, loff_t offset, (data + data_offset), num_bytes); data_offset += num_bytes; } -kunmap_atomic (ecryptfs_page_virt); +kunmap_local (ecryptfs_page_virt);flush_dcache_page (ecryptfs_page);SetPageUptodate (ecryptfs_page);unlock_page (ecryptfs_page);Signature · 1 line
2.39.0