minixfs: use offset_in_page()

It's cheaper and more idiomatic than subtracting page_address()
of the corresponding page...

Reviewed-by: Fabio M. De Francesco <fabio.maria.de.francesco@linux.intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2023-03-06 11:35:29 -05:00
parent b85ea95d08
commit 4812509e91

View File

@ -268,7 +268,7 @@ int minix_add_link(struct dentry *dentry, struct inode *inode)
return -EINVAL;
got_it:
pos = page_offset(page) + p - (char *)page_address(page);
pos = page_offset(page) + offset_in_page(p);
err = minix_prepare_chunk(page, pos, sbi->s_dirsize);
if (err)
goto out_unlock;
@ -296,8 +296,7 @@ out_unlock:
int minix_delete_entry(struct minix_dir_entry *de, struct page *page)
{
struct inode *inode = page->mapping->host;
char *kaddr = page_address(page);
loff_t pos = page_offset(page) + (char*)de - kaddr;
loff_t pos = page_offset(page) + offset_in_page(de);
struct minix_sb_info *sbi = minix_sb(inode->i_sb);
unsigned len = sbi->s_dirsize;
int err;
@ -421,8 +420,7 @@ int minix_set_link(struct minix_dir_entry *de, struct page *page,
{
struct inode *dir = page->mapping->host;
struct minix_sb_info *sbi = minix_sb(dir->i_sb);
loff_t pos = page_offset(page) +
(char *)de-(char*)page_address(page);
loff_t pos = page_offset(page) + offset_in_page(de);
int err;
lock_page(page);