Skip to content

Commit

Permalink
fs/adfs: mostly divorse inode number from indirect disc address
Browse files Browse the repository at this point in the history
Avoid using the inode number as the indirect disc address, even though
these currently have the same value.

Signed-off-by: Russell King <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Russell King authored and Al Viro committed Jan 21, 2020
1 parent 08ead1b commit 25e5d4d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions fs/adfs/adfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ static inline u16 adfs_filetype(u32 loadaddr)
struct adfs_inode_info {
loff_t mmu_private;
__u32 parent_id; /* parent indirect disc address */
__u32 indaddr; /* object indirect disc address */
__u32 loadaddr; /* RISC OS load address */
__u32 execaddr; /* RISC OS exec address */
unsigned int attr; /* RISC OS permissions */
Expand Down
4 changes: 2 additions & 2 deletions fs/adfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static int adfs_dir_read_inode(struct super_block *sb, struct inode *inode,
{
int ret;

ret = adfs_dir_read(sb, inode->i_ino, inode->i_size, dir);
ret = adfs_dir_read(sb, ADFS_I(inode)->indaddr, inode->i_size, dir);
if (ret)
return ret;

Expand Down Expand Up @@ -372,7 +372,7 @@ static int adfs_dir_lookup_byname(struct inode *inode, const struct qstr *qstr,
break;
}
}
obj->parent_id = inode->i_ino;
obj->parent_id = ADFS_I(inode)->indaddr;

unlock_relse:
up_read(&adfs_dir_rwsem);
Expand Down
6 changes: 4 additions & 2 deletions fs/adfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ adfs_get_block(struct inode *inode, sector_t block, struct buffer_head *bh,
if (block >= inode->i_blocks)
goto abort_toobig;

block = __adfs_block_map(inode->i_sb, inode->i_ino, block);
block = __adfs_block_map(inode->i_sb, ADFS_I(inode)->indaddr,
block);
if (block)
map_bh(bh, inode->i_sb, block);
return 0;
Expand Down Expand Up @@ -259,6 +260,7 @@ adfs_iget(struct super_block *sb, struct object_info *obj)
* for cross-directory renames.
*/
ADFS_I(inode)->parent_id = obj->parent_id;
ADFS_I(inode)->indaddr = obj->indaddr;
ADFS_I(inode)->loadaddr = obj->loadaddr;
ADFS_I(inode)->execaddr = obj->execaddr;
ADFS_I(inode)->attr = obj->attr;
Expand Down Expand Up @@ -353,7 +355,7 @@ int adfs_write_inode(struct inode *inode, struct writeback_control *wbc)
struct object_info obj;
int ret;

obj.indaddr = inode->i_ino;
obj.indaddr = ADFS_I(inode)->indaddr;
obj.name_len = 0;
obj.parent_id = ADFS_I(inode)->parent_id;
obj.loadaddr = ADFS_I(inode)->loadaddr;
Expand Down

0 comments on commit 25e5d4d

Please sign in to comment.