lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6c0cafed-c600-d499-ac26-13e4fa00737b@nvidia.com>
Date:   Wed, 5 Oct 2022 05:21:20 +0000
From:   Chaitanya Kulkarni <chaitanyak@...dia.com>
To:     Damien Le Moal <damien.lemoal@...nsource.wdc.com>,
        Chaitanya Kulkarni <chaitanyak@...dia.com>,
        "linux-block@...r.kernel.org" <linux-block@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC:     "axboe@...nel.dk" <axboe@...nel.dk>,
        "johannes.thumshirn@....com" <johannes.thumshirn@....com>,
        "bvanassche@....org" <bvanassche@....org>,
        "ming.lei@...hat.com" <ming.lei@...hat.com>,
        "shinichiro.kawasaki@....com" <shinichiro.kawasaki@....com>,
        "vincent.fu@...sung.com" <vincent.fu@...sung.com>,
        "yukuai3@...wei.com" <yukuai3@...wei.com>
Subject: Re: [PATCH 3/6] null_blk: code cleaup

On 10/4/22 22:02, Damien Le Moal wrote:
> On 10/5/22 12:16, Chaitanya Kulkarni wrote:
>> Introduce and use two new macros for calculating the page index from
>> given sector and index (offset) of the sector in the page.
>> The newly added macros makes code easy to read with meaningful name and
>> explanation comments attached to it.
>>
>> While at it adjust the code in the null_free_sector() to return early
>> to get rid of the extra identation.
>>
>> Signed-off-by: Chaitanya Kulkarni <kch@...dia.com>
>> ---
>>   drivers/block/null_blk/main.c | 37 ++++++++++++++++++++---------------
>>   1 file changed, 21 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
>> index 2d592b4eb815..b82c2ffeb086 100644
>> --- a/drivers/block/null_blk/main.c
>> +++ b/drivers/block/null_blk/main.c
>> @@ -14,6 +14,11 @@
>>   #undef pr_fmt
>>   #define pr_fmt(fmt)	"null_blk: " fmt
>>   
>> +/* Gives page index for which this sector belongs to. */
> 
> That is clear from the macro name. Not convinced this comment is useful.
> 
>> +#define PAGE_IDX_FROM_SECT(sect)	(sect >> PAGE_SECTORS_SHIFT)
>> +/* Gives index (offset) of the sector within page. */
>> +#define SECT_IDX_IN_PAGE(sect)		((sect & SECTOR_MASK) << SECTOR_SHIFT)
> 
> SECT_OFFSET_IN_PAGE() ? A "page" not being an array of sectors, using
> index for a sector is a little strange I think. And you use this macro for
> things like:
> 
> 	offset = SECT_IDX_IN_PAGE(sect);
> 
> So offset in the name makes more sense.
> 
>

okay I'll make it to SECT_OFFSET_IN_PAGE()

-ck

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ