fat: pass superblock pointer instead of inode pointer to fat_ent_read()
Subsystems (2)
PATCH v5 3/8 fat: pass superblock pointer instead of inode pointer to fat_ent_read()
From: Namjae Jeon <[email protected]>
Currently fat_ent_read() receives a pointer to inode as an argument which is used only to get a reference to the superblock.Instead, directly pass the superblock pointer to it.
This change is being done so that we can call fat_ent_read() from nfs.c even though we don't have a reference to the inode (In fact, we are trying to rebuild the inode and fat_ent_read() is necessary for it).
Signed-off-by Namjae Jeon <[email protected]>
Signed-off-by Ravishankar N <[email protected]>
Signed-off-by Amit Sahrawat <[email protected]>
--- fs/fat/cache.c | 2 +- fs/fat/fat.h | 2 +- fs/fat/fatent.c | 7 +++---- fs/fat/file.c | 2 +- fs/fat/misc.c | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-)
fs/fat/cache.c +1 -1
@@ -258,7 +258,7 @@ int fat_get_cluster(struct inode *inode, int cluster, int *fclus, int *dclus) goto out; } - nr =fat_ent_read (inode, &fatent, *dclus); + nr =fat_ent_read (sb, &fatent, *dclus);if (nr <0 ) goto out;else if (nr ==FAT_ENT_FREE ) {
fs/fat/fat.h +1 -1
@@ -333,7 +333,7 @@ static inline void fatent_brelse(struct fat_entry *fatent) }extern void fat_ent_access_init (struct super_block *sb); -extern int fat_ent_read (struct inode *inode,struct fat_entry *fatent, +extern int fat_ent_read (struct super_block *sb,struct fat_entry *fatent,int entry);extern int fat_ent_write (struct inode *inode,struct fat_entry *fatent,int new,int wait);
fs/fat/fatent.c +3 -4
@@ -348,10 +348,9 @@ static inline int fat_ent_update_ptr(struct super_block *sb,return 1 ; } -int fat_ent_read (struct inode *inode,struct fat_entry *fatent,int entry) +int fat_ent_read (struct super_block *sb,struct fat_entry *fatent,int entry) { -struct super_block *sb = inode->i_sb; -struct msdos_sb_info *sbi =MSDOS_SB (inode->i_sb); +struct msdos_sb_info *sbi =MSDOS_SB (sb);struct fatent_operations *ops = sbi->fatent_ops;int err, offset;sector_t blocknr;
@@ -564,7 +563,7 @@ int fat_free_clusters(struct inode *inode, int cluster)fatent_init (&fatent);lock_fat (sbi); do { - cluster = fat_ent_read(inode, &fatent, cluster); + cluster = fat_ent_read(sb, &fatent, cluster); if (cluster < 0) { err = cluster; goto error;
fs/fat/file.c +1 -1
@@ -256,7 +256,7 @@ static int fat_free(struct inode *inode, int skip)return 0 ;fatent_init (&fatent); - ret =fat_ent_read (inode, &fatent, dclus); + ret =fat_ent_read (sb, &fatent, dclus);if (ret ==FAT_ENT_EOF ) {fatent_brelse (&fatent);return 0 ;
fs/fat/misc.c +1 -1
@@ -127,7 +127,7 @@ int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster)struct fat_entry fatent;fatent_init (&fatent); - ret =fat_ent_read (inode, &fatent, last); + ret =fat_ent_read (sb, &fatent, last);if (ret >=0 ) {int wait =inode_needs_sync (inode); ret =fat_ent_write (inode, &fatent, new_dclus, wait);
Signature · 1 line
1.7.9.5