Skip to content

Commit

Permalink
[PATCH] fat: add fat_getattr()
Browse files Browse the repository at this point in the history
This adds fat_getattr() for setting stat->blksize. (FAT uses the size
of cluster for proper I/O)

Signed-off-by: OGAWA Hirofumi <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
OGAWAHirofumi authored and Linus Torvalds committed Nov 16, 2006
1 parent 565762f commit da63fc7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fs/fat/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,17 @@ void fat_truncate(struct inode *inode)
fat_flush_inodes(inode->i_sb, inode, NULL);
}

int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
struct inode *inode = dentry->d_inode;
generic_fillattr(inode, stat);
stat->blksize = MSDOS_SB(inode->i_sb)->cluster_size;
return 0;
}
EXPORT_SYMBOL_GPL(fat_getattr);

struct inode_operations fat_file_inode_operations = {
.truncate = fat_truncate,
.setattr = fat_notify_change,
.getattr = fat_getattr,
};
1 change: 1 addition & 0 deletions fs/msdos/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,7 @@ static struct inode_operations msdos_dir_inode_operations = {
.rmdir = msdos_rmdir,
.rename = msdos_rename,
.setattr = fat_notify_change,
.getattr = fat_getattr,
};

static int msdos_fill_super(struct super_block *sb, void *data, int silent)
Expand Down
1 change: 1 addition & 0 deletions fs/vfat/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,7 @@ static struct inode_operations vfat_dir_inode_operations = {
.rmdir = vfat_rmdir,
.rename = vfat_rename,
.setattr = fat_notify_change,
.getattr = fat_getattr,
};

static int vfat_fill_super(struct super_block *sb, void *data, int silent)
Expand Down
2 changes: 2 additions & 0 deletions include/linux/msdos_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ extern const struct file_operations fat_file_operations;
extern struct inode_operations fat_file_inode_operations;
extern int fat_notify_change(struct dentry * dentry, struct iattr * attr);
extern void fat_truncate(struct inode *inode);
extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat);

/* fat/inode.c */
extern void fat_attach(struct inode *inode, loff_t i_pos);
Expand Down

0 comments on commit da63fc7

Please sign in to comment.