Skip to content

Commit

Permalink
minixfs: Use dir_put_page() in minix_unlink() and minix_rename()
Browse files Browse the repository at this point in the history
... rather than open-coding it there.  Counterpart of the
corresponding fs/sysv commit from Fabio's series...

Reviewed-by: Fabio M. De Francesco <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Dec 19, 2023
1 parent ee0d27c commit 6628f69
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
6 changes: 0 additions & 6 deletions fs/minix/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ const struct file_operations minix_dir_operations = {
.fsync = generic_file_fsync,
};

static inline void dir_put_page(struct page *page)
{
kunmap(page);
put_page(page);
}

/*
* Return the offset into page `page_nr' of the last valid
* byte in that page, plus one.
Expand Down
5 changes: 5 additions & 0 deletions fs/minix/minix.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ extern int V2_minix_get_block(struct inode *, long, struct buffer_head *, int);
extern unsigned V1_minix_blocks(loff_t, struct super_block *);
extern unsigned V2_minix_blocks(loff_t, struct super_block *);

static inline void dir_put_page(struct page *page)
{
kunmap(page);
put_page(page);
}
extern struct minix_dir_entry *minix_find_entry(struct dentry*, struct page**);
extern int minix_add_link(struct dentry*, struct inode*);
extern int minix_delete_entry(struct minix_dir_entry*, struct page*);
Expand Down
12 changes: 4 additions & 8 deletions fs/minix/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,7 @@ static int minix_unlink(struct inode * dir, struct dentry *dentry)
if (!de)
return -ENOENT;
err = minix_delete_entry(de, page);
kunmap(page);
put_page(page);
dir_put_page(page);

if (err)
return err;
Expand Down Expand Up @@ -242,13 +241,10 @@ static int minix_rename(struct mnt_idmap *idmap,
inode_dec_link_count(old_dir);
}
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

0 comments on commit 6628f69

Please sign in to comment.