summaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2022-12-14 02:31:39 +0100
committerJan Kara <jack@suse.cz>2023-05-29 11:03:28 +0200
commitdae42837ba6dd441e4a569996d5f62986ffe01ed (patch)
tree8cfd1c8bf958322fe1389aba4acf67970aa6e87a /fs/ext2
parentext2_put_page(): accept any pointer within the page (diff)
downloadlinux-dae42837ba6dd441e4a569996d5f62986ffe01ed.tar.xz
linux-dae42837ba6dd441e4a569996d5f62986ffe01ed.zip
ext2_{set_link,delete_entry}(): don't bother with page_addr
ext2_set_link() simply doesn't use it anymore and ext2_delete_entry() can easily obtain it from the directory entry pointer... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Reviewed-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> Tested-by: Fabio M. De Francesco <fmdefrancesco@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/dir.c11
-rw-r--r--fs/ext2/ext2.h6
-rw-r--r--fs/ext2/namei.c9
3 files changed, 11 insertions, 15 deletions
diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c
index 31b2aab94da0..8cf91a7bbbb9 100644
--- a/fs/ext2/dir.c
+++ b/fs/ext2/dir.c
@@ -464,8 +464,7 @@ static int ext2_handle_dirsync(struct inode *dir)
}
int ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
- struct page *page, void *page_addr, struct inode *inode,
- bool update_times)
+ struct page *page, struct inode *inode, bool update_times)
{
loff_t pos = page_offset(page) + offset_in_page(de);
unsigned len = ext2_rec_len_from_disk(de->rec_len);
@@ -586,16 +585,16 @@ out_unlock:
* ext2_delete_entry deletes a directory entry by merging it with the
* previous entry. Page is up-to-date.
*/
-int ext2_delete_entry (struct ext2_dir_entry_2 *dir, struct page *page,
- char *kaddr)
+int ext2_delete_entry(struct ext2_dir_entry_2 *dir, struct page *page)
{
struct inode *inode = page->mapping->host;
+ char *kaddr = (char *)((unsigned long)dir & PAGE_MASK);
unsigned from = offset_in_page(dir) & ~(ext2_chunk_size(inode)-1);
unsigned to = offset_in_page(dir) +
ext2_rec_len_from_disk(dir->rec_len);
loff_t pos;
- ext2_dirent * pde = NULL;
- ext2_dirent * de = (ext2_dirent *) (kaddr + from);
+ ext2_dirent *pde = NULL;
+ ext2_dirent *de = (ext2_dirent *)(kaddr + from);
int err;
while ((char*)de < (char*)dir) {
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index d0531d4ef499..391edf57b944 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -731,13 +731,11 @@ extern int ext2_inode_by_name(struct inode *dir,
extern int ext2_make_empty(struct inode *, struct inode *);
extern struct ext2_dir_entry_2 *ext2_find_entry(struct inode *, const struct qstr *,
struct page **, void **res_page_addr);
-extern int ext2_delete_entry(struct ext2_dir_entry_2 *dir, struct page *page,
- char *kaddr);
+extern int ext2_delete_entry(struct ext2_dir_entry_2 *dir, struct page *page);
extern int ext2_empty_dir (struct inode *);
extern struct ext2_dir_entry_2 *ext2_dotdot(struct inode *dir, struct page **p, void **pa);
int ext2_set_link(struct inode *dir, struct ext2_dir_entry_2 *de,
- struct page *page, void *page_addr, struct inode *inode,
- bool update_times);
+ struct page *page, struct inode *inode, bool update_times);
static inline void ext2_put_page(struct page *page, void *page_addr)
{
kunmap_local(page_addr);
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c
index 50105d50c48a..3e7f895ac2da 100644
--- a/fs/ext2/namei.c
+++ b/fs/ext2/namei.c
@@ -287,7 +287,7 @@ static int ext2_unlink(struct inode * dir, struct dentry *dentry)
goto out;
}
- err = ext2_delete_entry (de, page, page_addr);
+ err = ext2_delete_entry(de, page);
ext2_put_page(page, de);
if (err)
goto out;
@@ -368,8 +368,7 @@ static int ext2_rename (struct mnt_idmap * idmap,
err = PTR_ERR(new_de);
goto out_dir;
}
- err = ext2_set_link(new_dir, new_de, new_page, page_addr,
- old_inode, true);
+ err = ext2_set_link(new_dir, new_de, new_page, old_inode, true);
ext2_put_page(new_page, new_de);
if (err)
goto out_dir;
@@ -392,11 +391,11 @@ static int ext2_rename (struct mnt_idmap * idmap,
old_inode->i_ctime = current_time(old_inode);
mark_inode_dirty(old_inode);
- err = ext2_delete_entry(old_de, old_page, old_page_addr);
+ err = ext2_delete_entry(old_de, old_page);
if (!err && dir_de) {
if (old_dir != new_dir)
err = ext2_set_link(old_inode, dir_de, dir_page,
- dir_page_addr, new_dir, false);
+ new_dir, false);
inode_dec_link_count(old_dir);
}