Re: [PATCH 04/24] metadump: Add initialization and release functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 23, 2023 at 09:36:38 AM -0700, Darrick J. Wong wrote:
> On Tue, May 23, 2023 at 02:30:30PM +0530, Chandan Babu R wrote:
>> Move metadump initialization and release functionality into corresponding
>> functions.
>
> "No functional changes"?
>

Yes, No functional changes are introduced by this patch. I will add that as
part of the commit description.

>> Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx>
>> ---
>>  db/metadump.c | 88 ++++++++++++++++++++++++++++++---------------------
>>  1 file changed, 52 insertions(+), 36 deletions(-)
>> 
>> diff --git a/db/metadump.c b/db/metadump.c
>> index 806cdfd68..e7a433c21 100644
>> --- a/db/metadump.c
>> +++ b/db/metadump.c
>> @@ -2984,6 +2984,54 @@ done:
>>  	return !write_buf(iocur_top);
>>  }
>>  
>> +static int
>> +init_metadump(void)
>> +{
>> +	metadump.metablock = (xfs_metablock_t *)calloc(BBSIZE + 1, BBSIZE);
>> +	if (metadump.metablock == NULL) {
>> +		print_warning("memory allocation failure");
>> +		return -1;
>> +	}
>> +	metadump.metablock->mb_blocklog = BBSHIFT;
>> +	metadump.metablock->mb_magic = cpu_to_be32(XFS_MD_MAGIC);
>> +
>> +	/* Set flags about state of metadump */
>> +	metadump.metablock->mb_info = XFS_METADUMP_INFO_FLAGS;
>> +	if (metadump.obfuscate)
>> +		metadump.metablock->mb_info |= XFS_METADUMP_OBFUSCATED;
>> +	if (!metadump.zero_stale_data)
>> +		metadump.metablock->mb_info |= XFS_METADUMP_FULLBLOCKS;
>> +	if (metadump.dirty_log)
>> +		metadump.metablock->mb_info |= XFS_METADUMP_DIRTYLOG;
>> +
>> +	metadump.block_index = (__be64 *)((char *)metadump.metablock +
>> +				sizeof(xfs_metablock_t));
>> +	metadump.block_buffer = (char *)(metadump.metablock) + BBSIZE;
>> +	metadump.num_indices = (BBSIZE - sizeof(xfs_metablock_t)) / sizeof(__be64);
>> +
>> +	/*
>> +	 * A metadump block can hold at most num_indices of BBSIZE sectors;
>> +	 * do not try to dump a filesystem with a sector size which does not
>> +	 * fit within num_indices (i.e. within a single metablock).
>> +	 */
>> +	if (mp->m_sb.sb_sectsize > metadump.num_indices * BBSIZE) {
>> +		print_warning("Cannot dump filesystem with sector size %u",
>> +			      mp->m_sb.sb_sectsize);
>> +		free(metadump.metablock);
>> +		return -1;
>> +	}
>> +
>> +	metadump.cur_index = 0;
>> +
>> +        return 0;
>
> Tabs, not spaces.
>

I tried to include your .vimrc configuration equivalent to my .emacs. But
looks like I didn't cover all the cases. I will fix up the whitespace
problems.

> With that fixed,
> Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>

Thank you.

-- 
chandan



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux