Skip to content

Commit 16c1802

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
xfs: cleanup xlog_alloc_log a bit
Remove the separate head variable, move the ic_datap initialization up a bit where the context is more obvious and remove the duplicate memset right after a zeroing memory allocation. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent be665a4 commit 16c1802

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

fs/xfs/xfs_log.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,6 @@ xlog_alloc_log(
13671367
int num_bblks)
13681368
{
13691369
struct xlog *log;
1370-
xlog_rec_header_t *head;
13711370
xlog_in_core_t **iclogp;
13721371
xlog_in_core_t *iclog, *prev_iclog=NULL;
13731372
int i;
@@ -1461,22 +1460,21 @@ xlog_alloc_log(
14611460
GFP_KERNEL | __GFP_RETRY_MAYFAIL);
14621461
if (!iclog->ic_header)
14631462
goto out_free_iclog;
1464-
head = iclog->ic_header;
1465-
memset(head, 0, sizeof(xlog_rec_header_t));
1466-
head->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM);
1467-
head->h_version = cpu_to_be32(
1463+
iclog->ic_header->h_magicno =
1464+
cpu_to_be32(XLOG_HEADER_MAGIC_NUM);
1465+
iclog->ic_header->h_version = cpu_to_be32(
14681466
xfs_has_logv2(log->l_mp) ? 2 : 1);
1469-
head->h_size = cpu_to_be32(log->l_iclog_size);
1470-
/* new fields */
1471-
head->h_fmt = cpu_to_be32(XLOG_FMT);
1472-
memcpy(&head->h_fs_uuid, &mp->m_sb.sb_uuid, sizeof(uuid_t));
1467+
iclog->ic_header->h_size = cpu_to_be32(log->l_iclog_size);
1468+
iclog->ic_header->h_fmt = cpu_to_be32(XLOG_FMT);
1469+
memcpy(&iclog->ic_header->h_fs_uuid, &mp->m_sb.sb_uuid,
1470+
sizeof(iclog->ic_header->h_fs_uuid));
14731471

1472+
iclog->ic_datap = (void *)iclog->ic_header + log->l_iclog_hsize;
14741473
iclog->ic_size = log->l_iclog_size - log->l_iclog_hsize;
14751474
iclog->ic_state = XLOG_STATE_ACTIVE;
14761475
iclog->ic_log = log;
14771476
atomic_set(&iclog->ic_refcnt, 0);
14781477
INIT_LIST_HEAD(&iclog->ic_callbacks);
1479-
iclog->ic_datap = (void *)iclog->ic_header + log->l_iclog_hsize;
14801478

14811479
init_waitqueue_head(&iclog->ic_force_wait);
14821480
init_waitqueue_head(&iclog->ic_write_wait);

0 commit comments

Comments
 (0)