diff options
author | Theodore Ts'o <tytso@mit.edu> | 2014-08-29 20:52:18 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-08-29 20:52:18 -0400 |
commit | f8b3b59d4d561368cf8c92d50218fc0d5be7cb46 (patch) | |
tree | 971213ad1946cf4d0716bfc47259ebc5f9546430 /fs/ext4/namei.c | |
parent | dd73b5d5cb675e2aa3b1d4952e208af1546f91c1 (diff) |
ext4: convert do_split() to use the ERR_PTR convention
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r-- | fs/ext4/namei.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index e6d51655ffcd..dec92b675b35 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -1509,7 +1509,7 @@ static struct ext4_dir_entry_2* dx_pack_dirents(char *base, unsigned blocksize) | |||
1509 | */ | 1509 | */ |
1510 | static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir, | 1510 | static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir, |
1511 | struct buffer_head **bh,struct dx_frame *frame, | 1511 | struct buffer_head **bh,struct dx_frame *frame, |
1512 | struct dx_hash_info *hinfo, int *error) | 1512 | struct dx_hash_info *hinfo) |
1513 | { | 1513 | { |
1514 | unsigned blocksize = dir->i_sb->s_blocksize; | 1514 | unsigned blocksize = dir->i_sb->s_blocksize; |
1515 | unsigned count, continued; | 1515 | unsigned count, continued; |
@@ -1532,8 +1532,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir, | |||
1532 | if (IS_ERR(bh2)) { | 1532 | if (IS_ERR(bh2)) { |
1533 | brelse(*bh); | 1533 | brelse(*bh); |
1534 | *bh = NULL; | 1534 | *bh = NULL; |
1535 | *error = PTR_ERR(bh2); | 1535 | return (struct ext4_dir_entry_2 *) bh2; |
1536 | return NULL; | ||
1537 | } | 1536 | } |
1538 | 1537 | ||
1539 | BUFFER_TRACE(*bh, "get_write_access"); | 1538 | BUFFER_TRACE(*bh, "get_write_access"); |
@@ -1593,8 +1592,7 @@ static struct ext4_dir_entry_2 *do_split(handle_t *handle, struct inode *dir, | |||
1593 | dxtrace(dx_show_leaf (hinfo, (struct ext4_dir_entry_2 *) data2, blocksize, 1)); | 1592 | dxtrace(dx_show_leaf (hinfo, (struct ext4_dir_entry_2 *) data2, blocksize, 1)); |
1594 | 1593 | ||
1595 | /* Which block gets the new entry? */ | 1594 | /* Which block gets the new entry? */ |
1596 | if (hinfo->hash >= hash2) | 1595 | if (hinfo->hash >= hash2) { |
1597 | { | ||
1598 | swap(*bh, bh2); | 1596 | swap(*bh, bh2); |
1599 | de = de2; | 1597 | de = de2; |
1600 | } | 1598 | } |
@@ -1614,8 +1612,7 @@ journal_error: | |||
1614 | brelse(bh2); | 1612 | brelse(bh2); |
1615 | *bh = NULL; | 1613 | *bh = NULL; |
1616 | ext4_std_error(dir->i_sb, err); | 1614 | ext4_std_error(dir->i_sb, err); |
1617 | *error = err; | 1615 | return ERR_PTR(err); |
1618 | return NULL; | ||
1619 | } | 1616 | } |
1620 | 1617 | ||
1621 | int ext4_find_dest_de(struct inode *dir, struct inode *inode, | 1618 | int ext4_find_dest_de(struct inode *dir, struct inode *inode, |
@@ -1838,8 +1835,8 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | |||
1838 | ext4_handle_dirty_dx_node(handle, dir, frame->bh); | 1835 | ext4_handle_dirty_dx_node(handle, dir, frame->bh); |
1839 | ext4_handle_dirty_dirent_node(handle, dir, bh); | 1836 | ext4_handle_dirty_dirent_node(handle, dir, bh); |
1840 | 1837 | ||
1841 | de = do_split(handle,dir, &bh, frame, &hinfo, &retval); | 1838 | de = do_split(handle,dir, &bh, frame, &hinfo); |
1842 | if (!de) { | 1839 | if (IS_ERR(de)) { |
1843 | /* | 1840 | /* |
1844 | * Even if the block split failed, we have to properly write | 1841 | * Even if the block split failed, we have to properly write |
1845 | * out all the changes we did so far. Otherwise we can end up | 1842 | * out all the changes we did so far. Otherwise we can end up |
@@ -1847,7 +1844,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | |||
1847 | */ | 1844 | */ |
1848 | ext4_mark_inode_dirty(handle, dir); | 1845 | ext4_mark_inode_dirty(handle, dir); |
1849 | dx_release(frames); | 1846 | dx_release(frames); |
1850 | return retval; | 1847 | return PTR_ERR(de); |
1851 | } | 1848 | } |
1852 | dx_release(frames); | 1849 | dx_release(frames); |
1853 | 1850 | ||
@@ -2071,9 +2068,11 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry, | |||
2071 | goto cleanup; | 2068 | goto cleanup; |
2072 | } | 2069 | } |
2073 | } | 2070 | } |
2074 | de = do_split(handle, dir, &bh, frame, &hinfo, &err); | 2071 | de = do_split(handle, dir, &bh, frame, &hinfo); |
2075 | if (!de) | 2072 | if (IS_ERR(de)) { |
2073 | err = PTR_ERR(de); | ||
2076 | goto cleanup; | 2074 | goto cleanup; |
2075 | } | ||
2077 | err = add_dirent_to_buf(handle, dentry, inode, de, bh); | 2076 | err = add_dirent_to_buf(handle, dentry, inode, de, bh); |
2078 | goto cleanup; | 2077 | goto cleanup; |
2079 | 2078 | ||