diff options
author | Alexey Khoroshilov <khoroshilov@ispras.ru> | 2011-07-06 02:30:00 +0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2011-07-07 17:45:46 +0200 |
commit | dd7f3d5458e5c0eded620fe8192abe7e418fc94c (patch) | |
tree | 80ccd8fe3d0e7dab7d18852ceac6b4093d3cd44a /fs/hfsplus/extents.c | |
parent | 5bd9d99d107c56ff7b35a29e930d85f91a07b2fd (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/extents.c')
-rw-r--r-- | fs/hfsplus/extents.c | 26 |
1 files changed, 18 insertions, 8 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, set_bit(HFSPLUS_I_EXT_DIRTY, &hip->flags); } -static void hfsplus_ext_write_extent_locked(struct inode *inode) +static int hfsplus_ext_write_extent_locked(struct inode *inode) { + int res; + if (HFSPLUS_I(inode)->extent_state & HFSPLUS_EXT_DIRTY) { struct hfs_find_data fd; - if (!hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd)) { - __hfsplus_ext_write_extent(inode, &fd); - hfs_find_exit(&fd); - } + res = hfs_find_init(HFSPLUS_SB(inode->i_sb)->ext_tree, &fd); + if (res) + return res; + __hfsplus_ext_write_extent(inode, &fd); + hfs_find_exit(&fd); } + return 0; } -void hfsplus_ext_write_extent(struct inode *inode) +int hfsplus_ext_write_extent(struct inode *inode) { + int res; + mutex_lock(&HFSPLUS_I(inode)->extents_lock); - hfsplus_ext_write_extent_locked(inode); + res = hfsplus_ext_write_extent_locked(inode); mutex_unlock(&HFSPLUS_I(inode)->extents_lock); + + return res; } static inline int __hfsplus_ext_read_extent(struct hfs_find_data *fd, @@ -477,7 +485,9 @@ out: insert_extent: dprint(DBG_EXTENT, "insert new extent\n"); - hfsplus_ext_write_extent_locked(inode); + res = hfsplus_ext_write_extent_locked(inode); + if (res) + goto out; memset(hip->cached_extents, 0, sizeof(hfsplus_extent_rec)); hip->cached_extents[0].start_block = cpu_to_be32(start); |