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>
This commit is contained in:
Al Viro 2022-12-13 20:31:39 -05:00 committed by Jan Kara
parent 91f646fb97
commit dae42837ba
3 changed files with 11 additions and 15 deletions

View file

@ -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 @@ int ext2_add_link (struct dentry *dentry, struct inode *inode)
* 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) {

View file

@ -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);

View file

@ -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);
}