mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
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>
This commit is contained in:
parent
4309093ecb
commit
4bb1a1375a
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user