Commit 96b87cbd authored by Fabio M. De Francesco's avatar Fabio M. De Francesco Committed by Jan Kara
Browse files

fs/ext2: 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().

kmap_atomic() is implemented like a kmap_local_page() which also disables
page-faults and preemption (the latter only for !PREEMPT_RT kernels).

However, the code within the mapping and un-mapping in ext2_make_empty()
does not depend on the above-mentioned side effects.

Therefore, a mere replacement of the old API with the new one is all it
is required (i.e., there is no need to explicitly add any calls to
pagefault_disable() and/or preempt_disable()).

Suggested-by: default avatarIra Weiny <ira.weiny@intel.com>
Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
Signed-off-by: default avatarFabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
Message-Id: <20221231174205.8492-1-fmdefrancesco@gmail.com>
parent b316c443
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -646,7 +646,7 @@ int ext2_make_empty(struct inode *inode, struct inode *parent)
		unlock_page(page);
		goto fail;
	}
	kaddr = kmap_atomic(page);
	kaddr = kmap_local_page(page);
	memset(kaddr, 0, chunk_size);
	de = (struct ext2_dir_entry_2 *)kaddr;
	de->name_len = 1;
@@ -661,7 +661,7 @@ int ext2_make_empty(struct inode *inode, struct inode *parent)
	de->inode = cpu_to_le32(parent->i_ino);
	memcpy (de->name, "..\0", 4);
	ext2_set_de_type (de, inode);
	kunmap_atomic(kaddr);
	kunmap_local(kaddr);
	ext2_commit_chunk(page, 0, chunk_size);
	err = ext2_handle_dirsync(inode);
fail: