mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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>
This commit is contained in:
committed by
Carlos Maiolino
parent
be665a4e27
commit
16c18021e1
@@ -1367,7 +1367,6 @@ xlog_alloc_log(
|
|||||||
int num_bblks)
|
int num_bblks)
|
||||||
{
|
{
|
||||||
struct xlog *log;
|
struct xlog *log;
|
||||||
xlog_rec_header_t *head;
|
|
||||||
xlog_in_core_t **iclogp;
|
xlog_in_core_t **iclogp;
|
||||||
xlog_in_core_t *iclog, *prev_iclog=NULL;
|
xlog_in_core_t *iclog, *prev_iclog=NULL;
|
||||||
int i;
|
int i;
|
||||||
@@ -1461,22 +1460,21 @@ xlog_alloc_log(
|
|||||||
GFP_KERNEL | __GFP_RETRY_MAYFAIL);
|
GFP_KERNEL | __GFP_RETRY_MAYFAIL);
|
||||||
if (!iclog->ic_header)
|
if (!iclog->ic_header)
|
||||||
goto out_free_iclog;
|
goto out_free_iclog;
|
||||||
head = iclog->ic_header;
|
iclog->ic_header->h_magicno =
|
||||||
memset(head, 0, sizeof(xlog_rec_header_t));
|
cpu_to_be32(XLOG_HEADER_MAGIC_NUM);
|
||||||
head->h_magicno = cpu_to_be32(XLOG_HEADER_MAGIC_NUM);
|
iclog->ic_header->h_version = cpu_to_be32(
|
||||||
head->h_version = cpu_to_be32(
|
|
||||||
xfs_has_logv2(log->l_mp) ? 2 : 1);
|
xfs_has_logv2(log->l_mp) ? 2 : 1);
|
||||||
head->h_size = cpu_to_be32(log->l_iclog_size);
|
iclog->ic_header->h_size = cpu_to_be32(log->l_iclog_size);
|
||||||
/* new fields */
|
iclog->ic_header->h_fmt = cpu_to_be32(XLOG_FMT);
|
||||||
head->h_fmt = cpu_to_be32(XLOG_FMT);
|
memcpy(&iclog->ic_header->h_fs_uuid, &mp->m_sb.sb_uuid,
|
||||||
memcpy(&head->h_fs_uuid, &mp->m_sb.sb_uuid, sizeof(uuid_t));
|
sizeof(iclog->ic_header->h_fs_uuid));
|
||||||
|
|
||||||
|
iclog->ic_datap = (void *)iclog->ic_header + log->l_iclog_hsize;
|
||||||
iclog->ic_size = log->l_iclog_size - log->l_iclog_hsize;
|
iclog->ic_size = log->l_iclog_size - log->l_iclog_hsize;
|
||||||
iclog->ic_state = XLOG_STATE_ACTIVE;
|
iclog->ic_state = XLOG_STATE_ACTIVE;
|
||||||
iclog->ic_log = log;
|
iclog->ic_log = log;
|
||||||
atomic_set(&iclog->ic_refcnt, 0);
|
atomic_set(&iclog->ic_refcnt, 0);
|
||||||
INIT_LIST_HEAD(&iclog->ic_callbacks);
|
INIT_LIST_HEAD(&iclog->ic_callbacks);
|
||||||
iclog->ic_datap = (void *)iclog->ic_header + log->l_iclog_hsize;
|
|
||||||
|
|
||||||
init_waitqueue_head(&iclog->ic_force_wait);
|
init_waitqueue_head(&iclog->ic_force_wait);
|
||||||
init_waitqueue_head(&iclog->ic_write_wait);
|
init_waitqueue_head(&iclog->ic_write_wait);
|
||||||
|
|||||||
Reference in New Issue
Block a user