aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfsplus
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2011-07-05 18:30:00 -0400
committerChristoph Hellwig <hch@lst.de>2011-07-07 11:45:46 -0400
commitdd7f3d5458e5c0eded620fe8192abe7e418fc94c (patch)
tree80ccd8fe3d0e7dab7d18852ceac6b4093d3cd44a /fs/hfsplus
parent5bd9d99d107c56ff7b35a29e930d85f91a07b2fd (diff)
hfsplus: Add error propagation for hfsplus_ext_write_extent_locked
Implement error propagation through the callers of hfsplus_ext_write_extent_locked(). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs/hfsplus')
-rw-r--r--fs/hfsplus/extents.c26
-rw-r--r--fs/hfsplus/hfsplus_fs.h2
-rw-r--r--fs/hfsplus/super.c6
3 files changed, 24 insertions, 10 deletions
diff --git a/fs/hfsplus/extents.c b/fs/hfsplus/extents.c
index 95065a89e7e2..5849e3ef35cc 100644
--- a/fs/hfsplus/extents.c
+++ b/fs/hfsplus/extents.c
@@ -119,23 +119,31 @@ static void __hfsplus_ext_write_extent(struct inode *inode,
119 set_bit(HFSPLUS_I_EXT_DIRTY, &hip->flags); 119 set_bit(HFSPLUS_I_EXT_DIRTY, &hip->flags);
120} 120}
121 121
122static void hfsplus_ext_write_extent_locked(struct inode *inode) 122static int hfsplus_ext_write_extent_locked(struct inode *inode)
123{ 123{
124 int res;
125
124 if (HFSPLUS_I(inode)->extent_state & HFSPLUS_EXT_DIRTY) { 126 if (HFSPLUS_I(inode)->extent_state & HFSPLUS_EXT_DIRTY) {
125 struct hfs_find_data fd; 127 struct hfs_find_data fd;
126 128
127 if (!hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd)) { 129 res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd);
128 __hfsplus_ext_write_extent(inode, &fd); 130 if (res)
129 hfs_find_exit(&fd); 131 return res;
130 } 132 __hfsplus_ext_write_extent(inode, &fd);
133 hfs_find_exit(&fd);
131 } 134 }
135 return 0;
132} 136}
133 137
134void hfsplus_ext_write_extent(struct inode *inode) 138int hfsplus_ext_write_extent(struct inode *inode)
135{ 139{
140 int res;
141
136 mutex_lock(&HFSPLUS_I(inode)->extents_lock); 142 mutex_lock(&HFSPLUS_I(inode)->extents_lock);
137 hfsplus_ext_write_extent_locked(inode); 143 res = hfsplus_ext_write_extent_locked(inode);
138 mutex_unlock(&HFSPLUS_I(inode)->extents_lock); 144 mutex_unlock(&HFSPLUS_I(inode)->extents_lock);
145
146 return res;
139} 147}
140 148
141static inline int __hfsplus_ext_read_extent(struct hfs_find_data *fd, 149static inline int __hfsplus_ext_read_extent(struct hfs_find_data *fd,
@@ -477,7 +485,9 @@ out:
477 485
478insert_extent: 486insert_extent:
479 dprint(DBG_EXTENT, "insert new extent\n"); 487 dprint(DBG_EXTENT, "insert new extent\n");
480 hfsplus_ext_write_extent_locked(inode); 488 res = hfsplus_ext_write_extent_locked(inode);
489 if (res)
490 goto out;
481 491
482 memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec)); 492 memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec));
483 hip->cached_extents[0].start_block = cpu_to_be32(start); 493 hip->cached_extents[0].start_block = cpu_to_be32(start);
diff --git a/fs/hfsplus/hfsplus_fs.h b/fs/hfsplus/hfsplus_fs.h
index d6857523336d..0bebf7488feb 100644
--- a/fs/hfsplus/hfsplus_fs.h
+++ b/fs/hfsplus/hfsplus_fs.h
@@ -374,7 +374,7 @@ extern const struct file_operations hfsplus_dir_operations;
374 374
375/* extents.c */ 375/* extents.c */
376int hfsplus_ext_cmp_key(const hfsplus_btree_key *, const hfsplus_btree_key *); 376int hfsplus_ext_cmp_key(const hfsplus_btree_key *, const hfsplus_btree_key *);
377void hfsplus_ext_write_extent(struct inode *); 377int hfsplus_ext_write_extent(struct inode *);
378int hfsplus_get_block(struct inode *, sector_t, struct buffer_head *, int); 378int hfsplus_get_block(struct inode *, sector_t, struct buffer_head *, int);
379int hfsplus_free_fork(struct super_block *, u32, 379int hfsplus_free_fork(struct super_block *, u32,
380 struct hfsplus_fork_raw *, int); 380 struct hfsplus_fork_raw *, int);
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 2c1a72287fb5..84f56e1f6dac 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -135,9 +135,13 @@ static int hfsplus_system_write_inode(struct inode *inode)
135static int hfsplus_write_inode(struct inode *inode, 135static int hfsplus_write_inode(struct inode *inode,
136 struct writeback_control *wbc) 136 struct writeback_control *wbc)
137{ 137{
138 int err;
139
138 dprint(DBG_INODE, "hfsplus_write_inode: %lu\n", inode->i_ino); 140 dprint(DBG_INODE, "hfsplus_write_inode: %lu\n", inode->i_ino);
139 141
140 hfsplus_ext_write_extent(inode); 142 err = hfsplus_ext_write_extent(inode);
143 if (err)
144 return err;
141 145
142 if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID || 146 if (inode->i_ino >= HFSPLUS_FIRSTUSER_CNID ||
143 inode->i_ino == HFSPLUS_ROOT_CNID) 147 inode->i_ino == HFSPLUS_ROOT_CNID)