Skip to content

Commit fd48e9a

Browse files
jankaratytso
authored andcommitted
ext4: unindent codeblock in ext4_xattr_block_set()
Remove unnecessary else (and thus indentation level) from a code block in ext4_xattr_block_set(). It will also make following code changes easier. No functional changes. CC: [email protected] Fixes: 82939d7 ("ext4: convert to mbcache2") Signed-off-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 6bc0d63 commit fd48e9a

File tree

1 file changed

+38
-39
lines changed

1 file changed

+38
-39
lines changed

fs/ext4/xattr.c

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1850,6 +1850,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
18501850
#define header(x) ((struct ext4_xattr_header *)(x))
18511851

18521852
if (s->base) {
1853+
int offset = (char *)s->here - bs->bh->b_data;
1854+
18531855
BUFFER_TRACE(bs->bh, "get_write_access");
18541856
error = ext4_journal_get_write_access(handle, sb, bs->bh,
18551857
EXT4_JTR_NONE);
@@ -1882,49 +1884,46 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
18821884
if (error)
18831885
goto cleanup;
18841886
goto inserted;
1885-
} else {
1886-
int offset = (char *)s->here - bs->bh->b_data;
1887+
}
1888+
unlock_buffer(bs->bh);
1889+
ea_bdebug(bs->bh, "cloning");
1890+
s->base = kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS);
1891+
error = -ENOMEM;
1892+
if (s->base == NULL)
1893+
goto cleanup;
1894+
s->first = ENTRY(header(s->base)+1);
1895+
header(s->base)->h_refcount = cpu_to_le32(1);
1896+
s->here = ENTRY(s->base + offset);
1897+
s->end = s->base + bs->bh->b_size;
18871898

1888-
unlock_buffer(bs->bh);
1889-
ea_bdebug(bs->bh, "cloning");
1890-
s->base = kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS);
1891-
error = -ENOMEM;
1892-
if (s->base == NULL)
1899+
/*
1900+
* If existing entry points to an xattr inode, we need
1901+
* to prevent ext4_xattr_set_entry() from decrementing
1902+
* ref count on it because the reference belongs to the
1903+
* original block. In this case, make the entry look
1904+
* like it has an empty value.
1905+
*/
1906+
if (!s->not_found && s->here->e_value_inum) {
1907+
ea_ino = le32_to_cpu(s->here->e_value_inum);
1908+
error = ext4_xattr_inode_iget(inode, ea_ino,
1909+
le32_to_cpu(s->here->e_hash),
1910+
&tmp_inode);
1911+
if (error)
18931912
goto cleanup;
1894-
s->first = ENTRY(header(s->base)+1);
1895-
header(s->base)->h_refcount = cpu_to_le32(1);
1896-
s->here = ENTRY(s->base + offset);
1897-
s->end = s->base + bs->bh->b_size;
18981913

1899-
/*
1900-
* If existing entry points to an xattr inode, we need
1901-
* to prevent ext4_xattr_set_entry() from decrementing
1902-
* ref count on it because the reference belongs to the
1903-
* original block. In this case, make the entry look
1904-
* like it has an empty value.
1905-
*/
1906-
if (!s->not_found && s->here->e_value_inum) {
1907-
ea_ino = le32_to_cpu(s->here->e_value_inum);
1908-
error = ext4_xattr_inode_iget(inode, ea_ino,
1909-
le32_to_cpu(s->here->e_hash),
1910-
&tmp_inode);
1911-
if (error)
1912-
goto cleanup;
1913-
1914-
if (!ext4_test_inode_state(tmp_inode,
1915-
EXT4_STATE_LUSTRE_EA_INODE)) {
1916-
/*
1917-
* Defer quota free call for previous
1918-
* inode until success is guaranteed.
1919-
*/
1920-
old_ea_inode_quota = le32_to_cpu(
1921-
s->here->e_value_size);
1922-
}
1923-
iput(tmp_inode);
1924-
1925-
s->here->e_value_inum = 0;
1926-
s->here->e_value_size = 0;
1914+
if (!ext4_test_inode_state(tmp_inode,
1915+
EXT4_STATE_LUSTRE_EA_INODE)) {
1916+
/*
1917+
* Defer quota free call for previous
1918+
* inode until success is guaranteed.
1919+
*/
1920+
old_ea_inode_quota = le32_to_cpu(
1921+
s->here->e_value_size);
19271922
}
1923+
iput(tmp_inode);
1924+
1925+
s->here->e_value_inum = 0;
1926+
s->here->e_value_size = 0;
19281927
}
19291928
} else {
19301929
/* Allocate a buffer where we construct the new block. */

0 commit comments

Comments
 (0)