mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
ufs: Convert ufs_set_link() and ufss_dotdot() to take a folio
This matches ext2 and removes 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:
parent
e95d275445
commit
597697c5ad
26
fs/ufs/dir.c
26
fs/ufs/dir.c
@ -89,23 +89,22 @@ ino_t ufs_inode_by_name(struct inode *dir, const struct qstr *qstr)
|
||||
|
||||
/* Releases the page */
|
||||
void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
|
||||
struct page *page, struct inode *inode,
|
||||
struct folio *folio, struct inode *inode,
|
||||
bool update_times)
|
||||
{
|
||||
loff_t pos = page_offset(page) +
|
||||
(char *) de - (char *) page_address(page);
|
||||
loff_t pos = folio_pos(folio) + offset_in_folio(folio, de);
|
||||
unsigned len = fs16_to_cpu(dir->i_sb, de->d_reclen);
|
||||
int err;
|
||||
|
||||
lock_page(page);
|
||||
err = ufs_prepare_chunk(page, pos, len);
|
||||
folio_lock(folio);
|
||||
err = ufs_prepare_chunk(&folio->page, pos, len);
|
||||
BUG_ON(err);
|
||||
|
||||
de->d_ino = cpu_to_fs32(dir->i_sb, inode->i_ino);
|
||||
ufs_set_de_type(dir->i_sb, de, inode->i_mode);
|
||||
|
||||
ufs_commit_chunk(page, pos, len);
|
||||
ufs_put_page(page);
|
||||
ufs_commit_chunk(&folio->page, pos, len);
|
||||
ufs_put_page(&folio->page);
|
||||
if (update_times)
|
||||
inode_set_mtime_to_ts(dir, inode_set_ctime_current(dir));
|
||||
mark_inode_dirty(dir);
|
||||
@ -233,17 +232,14 @@ ufs_next_entry(struct super_block *sb, struct ufs_dir_entry *p)
|
||||
fs16_to_cpu(sb, p->d_reclen));
|
||||
}
|
||||
|
||||
struct ufs_dir_entry *ufs_dotdot(struct inode *dir, struct page **p)
|
||||
struct ufs_dir_entry *ufs_dotdot(struct inode *dir, struct folio **foliop)
|
||||
{
|
||||
struct folio *folio;
|
||||
struct ufs_dir_entry *de = ufs_get_folio(dir, 0, &folio);
|
||||
struct ufs_dir_entry *de = ufs_get_folio(dir, 0, foliop);
|
||||
|
||||
if (IS_ERR(de))
|
||||
return NULL;
|
||||
de = ufs_next_entry(dir->i_sb, de);
|
||||
*p = &folio->page;
|
||||
if (!IS_ERR(de))
|
||||
return ufs_next_entry(dir->i_sb, de);
|
||||
|
||||
return de;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -249,7 +249,7 @@ static int ufs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||
{
|
||||
struct inode *old_inode = d_inode(old_dentry);
|
||||
struct inode *new_inode = d_inode(new_dentry);
|
||||
struct page *dir_page = NULL;
|
||||
struct folio *dir_folio = NULL;
|
||||
struct ufs_dir_entry * dir_de = NULL;
|
||||
struct folio *old_folio;
|
||||
struct ufs_dir_entry *old_de;
|
||||
@ -264,7 +264,7 @@ static int ufs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||
|
||||
if (S_ISDIR(old_inode->i_mode)) {
|
||||
err = -EIO;
|
||||
dir_de = ufs_dotdot(old_inode, &dir_page);
|
||||
dir_de = ufs_dotdot(old_inode, &dir_folio);
|
||||
if (!dir_de)
|
||||
goto out_old;
|
||||
}
|
||||
@ -281,7 +281,7 @@ static int ufs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||
new_de = ufs_find_entry(new_dir, &new_dentry->d_name, &new_folio);
|
||||
if (!new_de)
|
||||
goto out_dir;
|
||||
ufs_set_link(new_dir, new_de, &new_folio->page, old_inode, 1);
|
||||
ufs_set_link(new_dir, new_de, new_folio, old_inode, 1);
|
||||
inode_set_ctime_current(new_inode);
|
||||
if (dir_de)
|
||||
drop_nlink(new_inode);
|
||||
@ -305,10 +305,10 @@ static int ufs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||
|
||||
if (dir_de) {
|
||||
if (old_dir != new_dir)
|
||||
ufs_set_link(old_inode, dir_de, dir_page, new_dir, 0);
|
||||
ufs_set_link(old_inode, dir_de, dir_folio, new_dir, 0);
|
||||
else {
|
||||
kunmap(dir_page);
|
||||
put_page(dir_page);
|
||||
kunmap(&dir_folio->page);
|
||||
folio_put(dir_folio);
|
||||
}
|
||||
inode_dec_link_count(old_dir);
|
||||
}
|
||||
@ -317,8 +317,8 @@ static int ufs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||
|
||||
out_dir:
|
||||
if (dir_de) {
|
||||
kunmap(dir_page);
|
||||
put_page(dir_page);
|
||||
kunmap(&dir_folio->page);
|
||||
folio_put(dir_folio);
|
||||
}
|
||||
out_old:
|
||||
kunmap(&old_folio->page);
|
||||
|
@ -107,9 +107,9 @@ struct ufs_dir_entry *ufs_find_entry(struct inode *, const struct qstr *,
|
||||
struct folio **);
|
||||
int ufs_delete_entry(struct inode *, struct ufs_dir_entry *, struct page *);
|
||||
int ufs_empty_dir(struct inode *);
|
||||
struct ufs_dir_entry *ufs_dotdot(struct inode *, struct page **);
|
||||
struct ufs_dir_entry *ufs_dotdot(struct inode *, struct folio **);
|
||||
void ufs_set_link(struct inode *dir, struct ufs_dir_entry *de,
|
||||
struct page *page, struct inode *inode, bool update_times);
|
||||
struct folio *folio, struct inode *inode, bool update_times);
|
||||
|
||||
/* file.c */
|
||||
extern const struct inode_operations ufs_file_inode_operations;
|
||||
|
Loading…
Reference in New Issue
Block a user