sysv: Convert sysv_delete_entry() to work on a folio

Match ext2 and remove a few hidden calls to compound_head().

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Matthew Wilcox (Oracle) 2024-07-09 10:45:23 -04:00 committed by Christian Brauner
parent 1cfdaf9708
commit 9b1cf7790e
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
3 changed files with 10 additions and 10 deletions

View File

@ -231,20 +231,20 @@ out_unlock:
goto out_folio; goto out_folio;
} }
int sysv_delete_entry(struct sysv_dir_entry *de, struct page *page) int sysv_delete_entry(struct sysv_dir_entry *de, struct folio *folio)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = folio->mapping->host;
loff_t pos = page_offset(page) + offset_in_page(de); loff_t pos = folio_pos(folio) + offset_in_folio(folio, de);
int err; int err;
lock_page(page); folio_lock(folio);
err = sysv_prepare_chunk(page, pos, SYSV_DIRSIZE); err = sysv_prepare_chunk(&folio->page, pos, SYSV_DIRSIZE);
if (err) { if (err) {
unlock_page(page); folio_unlock(folio);
return err; return err;
} }
de->inode = 0; de->inode = 0;
dir_commit_chunk(page, pos, SYSV_DIRSIZE); dir_commit_chunk(&folio->page, pos, SYSV_DIRSIZE);
inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode));
mark_inode_dirty(inode); mark_inode_dirty(inode);
return sysv_handle_dirsync(inode); return sysv_handle_dirsync(inode);

View File

@ -159,7 +159,7 @@ static int sysv_unlink(struct inode * dir, struct dentry * dentry)
if (!de) if (!de)
return -ENOENT; return -ENOENT;
err = sysv_delete_entry(de, &folio->page); err = sysv_delete_entry(de, folio);
if (!err) { if (!err) {
inode_set_ctime_to_ts(inode, inode_get_ctime(dir)); inode_set_ctime_to_ts(inode, inode_get_ctime(dir));
inode_dec_link_count(inode); inode_dec_link_count(inode);
@ -242,7 +242,7 @@ static int sysv_rename(struct mnt_idmap *idmap, struct inode *old_dir,
inode_inc_link_count(new_dir); inode_inc_link_count(new_dir);
} }
err = sysv_delete_entry(old_de, &old_folio->page); err = sysv_delete_entry(old_de, old_folio);
if (err) if (err)
goto out_dir; goto out_dir;

View File

@ -150,7 +150,7 @@ extern void sysv_destroy_icache(void);
/* dir.c */ /* dir.c */
struct sysv_dir_entry *sysv_find_entry(struct dentry *, struct folio **); struct sysv_dir_entry *sysv_find_entry(struct dentry *, struct folio **);
int sysv_add_link(struct dentry *, struct inode *); int sysv_add_link(struct dentry *, struct inode *);
int sysv_delete_entry(struct sysv_dir_entry *, struct page *); int sysv_delete_entry(struct sysv_dir_entry *, struct folio *);
int sysv_make_empty(struct inode *, struct inode *); int sysv_make_empty(struct inode *, struct inode *);
int sysv_empty_dir(struct inode *); int sysv_empty_dir(struct inode *);
int sysv_set_link(struct sysv_dir_entry *, struct folio *, int sysv_set_link(struct sysv_dir_entry *, struct folio *,