aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/extents.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfsplus/extents.c')
-rw-r--r--fs/hfsplus/extents.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index b1017eaa4fdc..0c9cb1820a52 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -88,6 +88,8 @@ static void __hfsplus_ext_write_extent(struct inode *inode, struct hfs_find_data
88 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); 88 struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
89 int res; 89 int res;
90 90
91 WARN_ON(!mutex_is_locked(&hip->extents_lock));
92
91 hfsplus_ext_build_key(fd->search_key, inode->i_ino, hip->cached_start, 93 hfsplus_ext_build_key(fd->search_key, inode->i_ino, hip->cached_start,
92 HFSPLUS_IS_RSRC(inode) ? 94 HFSPLUS_IS_RSRC(inode) ?
93 HFSPLUS_TYPE_RSRC : HFSPLUS_TYPE_DATA); 95 HFSPLUS_TYPE_RSRC : HFSPLUS_TYPE_DATA);
@@ -108,7 +110,7 @@ static void __hfsplus_ext_write_extent(struct inode *inode, struct hfs_find_data
108 } 110 }
109} 111}
110 112
111void hfsplus_ext_write_extent(struct inode *inode) 113static void hfsplus_ext_write_extent_locked(struct inode *inode)
112{ 114{
113 if (HFSPLUS_I(inode)->flags & HFSPLUS_FLG_EXT_DIRTY) { 115 if (HFSPLUS_I(inode)->flags & HFSPLUS_FLG_EXT_DIRTY) {
114 struct hfs_find_data fd; 116 struct hfs_find_data fd;
@@ -119,6 +121,13 @@ void hfsplus_ext_write_extent(struct inode *inode)
119 } 121 }
120} 122}
121 123
124void hfsplus_ext_write_extent(struct inode *inode)
125{
126 mutex_lock(&HFSPLUS_I(inode)->extents_lock);
127 hfsplus_ext_write_extent_locked(inode);
128 mutex_unlock(&HFSPLUS_I(inode)->extents_lock);
129}
130
122static inline int __hfsplus_ext_read_extent(struct hfs_find_data *fd, 131static inline int __hfsplus_ext_read_extent(struct hfs_find_data *fd,
123 struct hfsplus_extent *extent, 132 struct hfsplus_extent *extent,
124 u32 cnid, u32 block, u8 type) 133 u32 cnid, u32 block, u8 type)
@@ -144,6 +153,8 @@ static inline int __hfsplus_ext_cache_extent(struct hfs_find_data *fd, struct in
144 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); 153 struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
145 int res; 154 int res;
146 155
156 WARN_ON(!mutex_is_locked(&hip->extents_lock));
157
147 if (hip->flags & HFSPLUS_FLG_EXT_DIRTY) 158 if (hip->flags & HFSPLUS_FLG_EXT_DIRTY)
148 __hfsplus_ext_write_extent(inode, fd); 159 __hfsplus_ext_write_extent(inode, fd);
149 160
@@ -433,7 +444,7 @@ out:
433 444
434insert_extent: 445insert_extent:
435 dprint(DBG_EXTENT, "insert new extent\n"); 446 dprint(DBG_EXTENT, "insert new extent\n");
436 hfsplus_ext_write_extent(inode); 447 hfsplus_ext_write_extent_locked(inode);
437 448
438 memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec)); 449 memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec));
439 hip->cached_extents[0].start_block = cpu_to_be32(start); 450 hip->cached_extents[0].start_block = cpu_to_be32(start);