aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/extents.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@tuxera.com>2010-11-23 08:38:13 -0500
committerChristoph Hellwig <hch@lst.de>2010-11-23 08:38:13 -0500
commitb33b7921db14abcd10c30d0ccfc68e364f5ef7fe (patch)
tree208810679b25995ba47f00bb1915a19f644931f5 /fs/hfsplus/extents.c
parenteb29d66d4f2dc98a81ae590bbdddc8cfa8964d73 (diff)
hfsplus: split up inode flags
Split the flags field in the hfsplus inode into an extent_state flag that is locked by the extent_lock, and a new flags field that uses atomic bitops. The second will grow more flags in the next patch. Signed-off-by: Christoph Hellwig <hch@tuxera.com>
Diffstat (limited to 'fs/hfsplus/extents.c')
-rw-r--r--fs/hfsplus/extents.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index 0c9cb1820a52..06b4fc3151a3 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -95,24 +95,24 @@ static void __hfsplus_ext_write_extent(struct inode *inode, struct hfs_find_data
95 HFSPLUS_TYPE_RSRC : HFSPLUS_TYPE_DATA); 95 HFSPLUS_TYPE_RSRC : HFSPLUS_TYPE_DATA);
96 96
97 res = hfs_brec_find(fd); 97 res = hfs_brec_find(fd);
98 if (hip->flags & HFSPLUS_FLG_EXT_NEW) { 98 if (hip->extent_state & HFSPLUS_EXT_NEW) {
99 if (res != -ENOENT) 99 if (res != -ENOENT)
100 return; 100 return;
101 hfs_brec_insert(fd, hip->cached_extents, 101 hfs_brec_insert(fd, hip->cached_extents,
102 sizeof(hfsplus_extent_rec)); 102 sizeof(hfsplus_extent_rec));
103 hip->flags &= ~(HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW); 103 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW);
104 } else { 104 } else {
105 if (res) 105 if (res)
106 return; 106 return;
107 hfs_bnode_write(fd->bnode, hip->cached_extents, 107 hfs_bnode_write(fd->bnode, hip->cached_extents,
108 fd->entryoffset, fd->entrylength); 108 fd->entryoffset, fd->entrylength);
109 hip->flags &= ~HFSPLUS_FLG_EXT_DIRTY; 109 hip->extent_state &= ~HFSPLUS_EXT_DIRTY;
110 } 110 }
111} 111}
112 112
113static void hfsplus_ext_write_extent_locked(struct inode *inode) 113static void hfsplus_ext_write_extent_locked(struct inode *inode)
114{ 114{
115 if (HFSPLUS_I(inode)->flags & HFSPLUS_FLG_EXT_DIRTY) { 115 if (HFSPLUS_I(inode)->extent_state & HFSPLUS_EXT_DIRTY) {
116 struct hfs_find_data fd; 116 struct hfs_find_data fd;
117 117
118 hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd); 118 hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd);
@@ -155,7 +155,7 @@ static inline int __hfsplus_ext_cache_extent(struct hfs_find_data *fd, struct in
155 155
156 WARN_ON(!mutex_is_locked(&hip->extents_lock)); 156 WARN_ON(!mutex_is_locked(&hip->extents_lock));
157 157
158 if (hip->flags & HFSPLUS_FLG_EXT_DIRTY) 158 if (hip->extent_state & HFSPLUS_EXT_DIRTY)
159 __hfsplus_ext_write_extent(inode, fd); 159 __hfsplus_ext_write_extent(inode, fd);
160 160
161 res = __hfsplus_ext_read_extent(fd, hip->cached_extents, inode->i_ino, 161 res = __hfsplus_ext_read_extent(fd, hip->cached_extents, inode->i_ino,
@@ -167,7 +167,7 @@ static inline int __hfsplus_ext_cache_extent(struct hfs_find_data *fd, struct in
167 hip->cached_blocks = hfsplus_ext_block_count(hip->cached_extents); 167 hip->cached_blocks = hfsplus_ext_block_count(hip->cached_extents);
168 } else { 168 } else {
169 hip->cached_start = hip->cached_blocks = 0; 169 hip->cached_start = hip->cached_blocks = 0;
170 hip->flags &= ~(HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW); 170 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW);
171 } 171 }
172 return res; 172 return res;
173} 173}
@@ -429,7 +429,7 @@ int hfsplus_file_extend(struct inode *inode)
429 start, len); 429 start, len);
430 if (!res) { 430 if (!res) {
431 hfsplus_dump_extent(hip->cached_extents); 431 hfsplus_dump_extent(hip->cached_extents);
432 hip->flags |= HFSPLUS_FLG_EXT_DIRTY; 432 hip->extent_state |= HFSPLUS_EXT_DIRTY;
433 hip->cached_blocks += len; 433 hip->cached_blocks += len;
434 } else if (res == -ENOSPC) 434 } else if (res == -ENOSPC)
435 goto insert_extent; 435 goto insert_extent;
@@ -450,7 +450,7 @@ insert_extent:
450 hip->cached_extents[0].start_block = cpu_to_be32(start); 450 hip->cached_extents[0].start_block = cpu_to_be32(start);
451 hip->cached_extents[0].block_count = cpu_to_be32(len); 451 hip->cached_extents[0].block_count = cpu_to_be32(len);
452 hfsplus_dump_extent(hip->cached_extents); 452 hfsplus_dump_extent(hip->cached_extents);
453 hip->flags |= HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW; 453 hip->extent_state |= HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW;
454 hip->cached_start = hip->alloc_blocks; 454 hip->cached_start = hip->alloc_blocks;
455 hip->cached_blocks = len; 455 hip->cached_blocks = len;
456 456
@@ -513,12 +513,12 @@ void hfsplus_file_truncate(struct inode *inode)
513 alloc_cnt - start, alloc_cnt - blk_cnt); 513 alloc_cnt - start, alloc_cnt - blk_cnt);
514 hfsplus_dump_extent(hip->cached_extents); 514 hfsplus_dump_extent(hip->cached_extents);
515 if (blk_cnt > start) { 515 if (blk_cnt > start) {
516 hip->flags |= HFSPLUS_FLG_EXT_DIRTY; 516 hip->extent_state |= HFSPLUS_EXT_DIRTY;
517 break; 517 break;
518 } 518 }
519 alloc_cnt = start; 519 alloc_cnt = start;
520 hip->cached_start = hip->cached_blocks = 0; 520 hip->cached_start = hip->cached_blocks = 0;
521 hip->flags &= ~(HFSPLUS_FLG_EXT_DIRTY | HFSPLUS_FLG_EXT_NEW); 521 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW);
522 hfs_brec_remove(&fd); 522 hfs_brec_remove(&fd);
523 } 523 }
524 hfs_find_exit(&fd); 524 hfs_find_exit(&fd);