Skip to content

Commit

Permalink
fs/sysv: Use dir_put_page() in sysv_rename()
Browse files Browse the repository at this point in the history
Use the dir_put_page() helper in sysv_rename() instead of open-coding two
kunmap() + put_page().

Cc: Al Viro <viro@zeniv.linux.org.uk>
Suggested-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
xp4ns3 authored and Al Viro committed Jan 20, 2023
1 parent 8dd6c7b commit c26ddc4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion fs/sysv/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const struct file_operations sysv_dir_operations = {
.fsync = generic_file_fsync,
};

static inline void dir_put_page(struct page *page)
inline void dir_put_page(struct page *page)
{
kunmap(page);
put_page(page);
Expand Down
9 changes: 3 additions & 6 deletions fs/sysv/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,10 @@ static int sysv_rename(struct user_namespace *mnt_userns, struct inode *old_dir,
return 0;

out_dir:
if (dir_de) {
kunmap(dir_page);
put_page(dir_page);
}
if (dir_de)
dir_put_page(dir_page);
out_old:
kunmap(old_page);
put_page(old_page);
dir_put_page(old_page);
out:
return err;
}
Expand Down
1 change: 1 addition & 0 deletions fs/sysv/sysv.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ extern void sysv_destroy_icache(void);


/* dir.c */
extern void dir_put_page(struct page *page);
extern struct sysv_dir_entry *sysv_find_entry(struct dentry *, struct page **);
extern int sysv_add_link(struct dentry *, struct inode *);
extern int sysv_delete_entry(struct sysv_dir_entry *, struct page *);
Expand Down

0 comments on commit c26ddc4

Please sign in to comment.