diff options
author | Fabio M. De Francesco <fmdefrancesco@gmail.com> | 2023-01-19 16:32:29 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2023-01-19 19:45:38 -0500 |
commit | 4bb1a1375ac33950385d17321c546aeb520ba152 (patch) | |
tree | b845c511f46bc42da8b138a8310a6dc3aeba3343 /fs | |
parent | 4309093ecb841bbd27fcd23525dd41b9a6b437ea (diff) |
fs/sysv: Use the offset_in_page() helper
Use the offset_in_page() helper because it is more suitable than doing
explicit subtractions between pointers to directory entries and kernel
virtual addresses of mapped pages.
Cc: Ira Weiny <ira.weiny@intel.com>
Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sysv/dir.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c index 16730795a621..0edd18e1d376 100644 --- a/fs/sysv/dir.c +++ b/fs/sysv/dir.c @@ -211,8 +211,7 @@ int sysv_add_link(struct dentry *dentry, struct inode *inode) return -EINVAL; got_it: - pos = page_offset(page) + - (char*)de - (char*)page_address(page); + pos = page_offset(page) + offset_in_page(de); lock_page(page); err = sysv_prepare_chunk(page, pos, SYSV_DIRSIZE); if (err) @@ -236,8 +235,7 @@ out_unlock: int sysv_delete_entry(struct sysv_dir_entry *de, struct page *page) { struct inode *inode = page->mapping->host; - char *kaddr = (char*)page_address(page); - loff_t pos = page_offset(page) + (char *)de - kaddr; + loff_t pos = page_offset(page) + offset_in_page(de); int err; lock_page(page); @@ -335,8 +333,7 @@ void sysv_set_link(struct sysv_dir_entry *de, struct page *page, struct inode *inode) { struct inode *dir = page->mapping->host; - 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); |