Skip to content

Commit b67798d

Browse files
jankaratytso
authored andcommitted
ext2: unindent codeblock in ext2_xattr_set()
Replace one else in ext2_xattr_set() with a goto. This makes following code changes simpler to follow. No functional changes. Signed-off-by: Jan Kara <[email protected]> Reviewed-by: Ritesh Harjani (IBM) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 90ae40d commit b67798d

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

fs/ext2/xattr.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,8 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
517517
/* Here we know that we can set the new attribute. */
518518

519519
if (header) {
520-
/* assert(header == HDR(bh)); */
520+
int offset;
521+
521522
lock_buffer(bh);
522523
if (header->h_refcount == cpu_to_le32(1)) {
523524
__u32 hash = le32_to_cpu(header->h_hash);
@@ -531,22 +532,20 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
531532
bh->b_blocknr);
532533

533534
/* keep the buffer locked while modifying it. */
534-
} else {
535-
int offset;
536-
537-
unlock_buffer(bh);
538-
ea_bdebug(bh, "cloning");
539-
header = kmemdup(HDR(bh), bh->b_size, GFP_KERNEL);
540-
error = -ENOMEM;
541-
if (header == NULL)
542-
goto cleanup;
543-
header->h_refcount = cpu_to_le32(1);
544-
545-
offset = (char *)here - bh->b_data;
546-
here = ENTRY((char *)header + offset);
547-
offset = (char *)last - bh->b_data;
548-
last = ENTRY((char *)header + offset);
535+
goto update_block;
549536
}
537+
unlock_buffer(bh);
538+
ea_bdebug(bh, "cloning");
539+
header = kmemdup(HDR(bh), bh->b_size, GFP_KERNEL);
540+
error = -ENOMEM;
541+
if (header == NULL)
542+
goto cleanup;
543+
header->h_refcount = cpu_to_le32(1);
544+
545+
offset = (char *)here - bh->b_data;
546+
here = ENTRY((char *)header + offset);
547+
offset = (char *)last - bh->b_data;
548+
last = ENTRY((char *)header + offset);
550549
} else {
551550
/* Allocate a buffer where we construct the new block. */
552551
header = kzalloc(sb->s_blocksize, GFP_KERNEL);
@@ -559,6 +558,7 @@ ext2_xattr_set(struct inode *inode, int name_index, const char *name,
559558
last = here = ENTRY(header+1);
560559
}
561560

561+
update_block:
562562
/* Iff we are modifying the block in-place, bh is locked here. */
563563

564564
if (not_found) {

0 commit comments

Comments
 (0)