diff options
author | Christoph Hellwig <hch@tuxera.com> | 2010-11-23 14:38:15 +0100 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2010-11-23 14:38:15 +0100 |
commit | e34947056076ca5467ee8256d2d9cbc594a79b37 (patch) | |
tree | c1b70f51c1e4bc38e0b0389224862afe26c5720f /fs/hfsplus/hfsplus_fs.h | |
parent | hfsplus: split up inode flags (diff) | |
download | linux-e34947056076ca5467ee8256d2d9cbc594a79b37.tar.xz linux-e34947056076ca5467ee8256d2d9cbc594a79b37.zip |
hfsplus: optimize fsync
Avoid doing unessecary work in fsync. Do nothing unless the inode
was marked dirty, and only write the various metadata inodes out if
they contain any dirty state from this inode. This is archived by
adding three new dirty bits to the hfsplus-specific inode which are
set in the correct places.
Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Diffstat (limited to 'fs/hfsplus/hfsplus_fs.h')
-rw-r--r-- | fs/hfsplus/hfsplus_fs.h | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h index 9889d0033b8f..65c698f78ef7 100644 --- a/fs/hfsplus/hfsplus_fs.h +++ b/fs/hfsplus/hfsplus_fs.h @@ -157,6 +157,11 @@ struct hfsplus_sb_info { #define HFSPLUS_SB_HFSX 3 #define HFSPLUS_SB_CASEFOLD 4 +static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb) +{ + return sb->s_fs_info; +} + struct hfsplus_inode_info { atomic_t opencnt; @@ -205,10 +210,31 @@ struct hfsplus_inode_info { #define HFSPLUS_EXT_NEW 0x0002 #define HFSPLUS_I_RSRC 0 /* represents a resource fork */ +#define HFSPLUS_I_CAT_DIRTY 1 /* has changes in the catalog tree */ +#define HFSPLUS_I_EXT_DIRTY 2 /* has changes in the extent tree */ +#define HFSPLUS_I_ALLOC_DIRTY 3 /* has changes in the allocation file */ #define HFSPLUS_IS_RSRC(inode) \ test_bit(HFSPLUS_I_RSRC, &HFSPLUS_I(inode)->flags) +static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode) +{ + return list_entry(inode, struct hfsplus_inode_info, vfs_inode); +} + +/* + * Mark an inode dirty, and also mark the btree in which the + * specific type of metadata is stored. + * For data or metadata that gets written back by into the catalog btree + * by hfsplus_write_inode a plain mark_inode_dirty call is enough. + */ +static inline void hfsplus_mark_inode_dirty(struct inode *inode, + unsigned int flag) +{ + set_bit(flag, &HFSPLUS_I(inode)->flags); + mark_inode_dirty(inode); +} + struct hfs_find_data { /* filled by caller */ hfsplus_btree_key *search_key; @@ -397,17 +423,6 @@ int hfs_part_find(struct super_block *, sector_t *, sector_t *); int hfsplus_submit_bio(struct block_device *bdev, sector_t sector, void *data, int rw); -/* access macros */ -static inline struct hfsplus_sb_info *HFSPLUS_SB(struct super_block *sb) -{ - return sb->s_fs_info; -} - -static inline struct hfsplus_inode_info *HFSPLUS_I(struct inode *inode) -{ - return list_entry(inode, struct hfsplus_inode_info, vfs_inode); -} - /* time macros */ #define __hfsp_mt2ut(t) (be32_to_cpu(t) - 2082844800U) #define __hfsp_ut2mt(t) (cpu_to_be32(t + 2082844800U)) |