aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus/extents.c
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2013-04-30 18:27:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 20:04:05 -0400
commitd7a475d0c4a22ce12ae1d099b76327aa1637ce07 (patch)
tree16aa5a76b5e0394643eae3928de4e6f71d66015f /fs/hfsplus/extents.c
parentd614267329f2bee7a082ed8781c581c0f3aaa808 (diff)
hfsplus: add error propagation to __hfsplus_ext_write_extent()
__hfsplus_ext_write_extent() suppresses errors coming from hfs_brec_find(). The patch implements error code propagation. Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com> Cc: Hin-Tak Leung <htl10@users.sourceforge.net> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hfsplus/extents.c')
-rw-r--r--fs/hfsplus/extents.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index 43658c6694c8..fbb212fbb1ef 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -83,7 +83,7 @@ static u32 hfsplus_ext_lastblock(struct hfsplus_extent *ext)
83 return be32_to_cpu(ext->start_block) + be32_to_cpu(ext->block_count); 83 return be32_to_cpu(ext->start_block) + be32_to_cpu(ext->block_count);
84} 84}
85 85
86static void __hfsplus_ext_write_extent(struct inode *inode, 86static int __hfsplus_ext_write_extent(struct inode *inode,
87 struct hfs_find_data *fd) 87 struct hfs_find_data *fd)
88{ 88{
89 struct hfsplus_inode_info *hip = HFSPLUS_I(inode); 89 struct hfsplus_inode_info *hip = HFSPLUS_I(inode);
@@ -98,13 +98,13 @@ static void __hfsplus_ext_write_extent(struct inode *inode,
98 res = hfs_brec_find(fd, hfs_find_rec_by_key); 98 res = hfs_brec_find(fd, hfs_find_rec_by_key);
99 if (hip->extent_state & HFSPLUS_EXT_NEW) { 99 if (hip->extent_state & HFSPLUS_EXT_NEW) {
100 if (res != -ENOENT) 100 if (res != -ENOENT)
101 return; 101 return res;
102 hfs_brec_insert(fd, hip->cached_extents, 102 hfs_brec_insert(fd, hip->cached_extents,
103 sizeof(hfsplus_extent_rec)); 103 sizeof(hfsplus_extent_rec));
104 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW); 104 hip->extent_state &= ~(HFSPLUS_EXT_DIRTY | HFSPLUS_EXT_NEW);
105 } else { 105 } else {
106 if (res) 106 if (res)
107 return; 107 return res;
108 hfs_bnode_write(fd->bnode, hip->cached_extents, 108 hfs_bnode_write(fd->bnode, hip->cached_extents,
109 fd->entryoffset, fd->entrylength); 109 fd->entryoffset, fd->entrylength);
110 hip->extent_state &= ~HFSPLUS_EXT_DIRTY; 110 hip->extent_state &= ~HFSPLUS_EXT_DIRTY;
@@ -117,11 +117,13 @@ static void __hfsplus_ext_write_extent(struct inode *inode,
117 * to explicily mark the inode dirty, too. 117 * to explicily mark the inode dirty, too.
118 */ 118 */
119 set_bit(HFSPLUS_I_EXT_DIRTY, &hip->flags); 119 set_bit(HFSPLUS_I_EXT_DIRTY, &hip->flags);
120
121 return 0;
120} 122}
121 123
122static int hfsplus_ext_write_extent_locked(struct inode *inode) 124static int hfsplus_ext_write_extent_locked(struct inode *inode)
123{ 125{
124 int res; 126 int res = 0;
125 127
126 if (HFSPLUS_I(inode)->extent_state & HFSPLUS_EXT_DIRTY) { 128 if (HFSPLUS_I(inode)->extent_state & HFSPLUS_EXT_DIRTY) {
127 struct hfs_find_data fd; 129 struct hfs_find_data fd;
@@ -129,10 +131,10 @@ static int hfsplus_ext_write_extent_locked(struct inode *inode)
129 res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd); 131 res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd);
130 if (res) 132 if (res)
131 return res; 133 return res;
132 __hfsplus_ext_write_extent(inode, &fd); 134 res = __hfsplus_ext_write_extent(inode, &fd);
133 hfs_find_exit(&fd); 135 hfs_find_exit(&fd);
134 } 136 }
135 return 0; 137 return res;
136} 138}
137 139
138int hfsplus_ext_write_extent(struct inode *inode) 140int hfsplus_ext_write_extent(struct inode *inode)
@@ -175,8 +177,11 @@ static inline int __hfsplus_ext_cache_extent(struct hfs_find_data *fd,
175 177
176 WARN_ON(!mutex_is_locked(&hip->extents_lock)); 178 WARN_ON(!mutex_is_locked(&hip->extents_lock));
177 179
178 if (hip->extent_state & HFSPLUS_EXT_DIRTY) 180 if (hip->extent_state & HFSPLUS_EXT_DIRTY) {
179 __hfsplus_ext_write_extent(inode, fd); 181 res = __hfsplus_ext_write_extent(inode, fd);
182 if (res)
183 return res;
184 }
180 185
181 res = __hfsplus_ext_read_extent(fd, hip->cached_extents, inode->i_ino, 186 res = __hfsplus_ext_read_extent(fd, hip->cached_extents, inode->i_ino,
182 block, HFSPLUS_IS_RSRC(inode) ? 187 block, HFSPLUS_IS_RSRC(inode) ?