Re: [PATCH 1/2] mkfs: Break block discard into chunks of 2 GB

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

 



On 11/21/19 3:55 PM, Darrick J. Wong wrote:
> On Thu, Nov 21, 2019 at 10:44:44PM +0100, Pavel Reichl wrote:

concur w/ others that a reason for the change (and a reason for the
size selection) would be appropriate to have in the changelog.

>> Signed-off-by: Pavel Reichl <preichl@xxxxxxxxxx>
>> ---
>>  mkfs/xfs_mkfs.c | 32 +++++++++++++++++++++++++-------
>>  1 file changed, 25 insertions(+), 7 deletions(-)
>>
>> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
>> index 18338a61..a02d6f66 100644
>> --- a/mkfs/xfs_mkfs.c
>> +++ b/mkfs/xfs_mkfs.c
>> @@ -1242,15 +1242,33 @@ done:
>>  static void
>>  discard_blocks(dev_t dev, uint64_t nsectors)
>>  {
>> -	int fd;
>> +	int		fd;
>> +	uint64_t	offset		= 0;
>> +	/* Maximal chunk of bytes to discard is 2GB */
>> +	const uint64_t	step		= (uint64_t)2<<30;
> 
> You don't need the tabs after the variable name, e.g.
> 
> 	/* Maximal chunk of bytes to discard is 2GB */
> 	const uint64_t	step = 2ULL << 30;
> 
>> +	/* Sector size is 512 bytes */
>> +	const uint64_t	count		= nsectors << 9;
> 
> count = BBTOB(nsectors)?

FYI this is a macro that xfs developers have learned about. ;)  It stands for
"Basic Block TO Byte" where "basic block" pretty much means "512-byte sector."

-Eric




[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