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] [day] [month] [year] [list]
Message-ID: <1338945e-5033-3bb2-0480-7c6767bf0848@huaweicloud.com>
Date:   Mon, 20 Nov 2023 21:24:02 +0800
From:   Yu Kuai <yukuai1@...weicloud.com>
To:     Hannes Reinecke <hare@...e.de>, Yu Kuai <yukuai1@...weicloud.com>,
        axboe@...nel.dk
Cc:     linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        yi.zhang@...wei.com, yangerkun@...wei.com,
        Ming Lei <ming.lei@...hat.com>,
        "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH 1/2] block: introduce new field flags in block_device

Hi,

在 2023/11/20 18:45, Hannes Reinecke 写道:
> On 11/20/23 10:38, Yu Kuai wrote:
>> From: Yu Kuai <yukuai3@...wei.com>
>>
>> There are multiple switches in struct block_device, use seperate bool
>> fields for them is not gracefully. Add a new field flags and replace
>> swithes to a bit, there are no functional changes, and preapre to add
>> a new switch in the next patch.
>>
>> Signed-off-by: Yu Kuai <yukuai3@...wei.com>
>> ---
>>   block/bdev.c              | 15 ++++++++-------
>>   block/blk-core.c          |  7 ++++---
>>   block/genhd.c             |  8 +++++---
>>   block/ioctl.c             |  2 +-
>>   include/linux/blk_types.h | 12 ++++++------
>>   include/linux/blkdev.h    |  5 +++--
>>   6 files changed, 27 insertions(+), 22 deletions(-)
>>
>> diff --git a/block/bdev.c b/block/bdev.c
>> index fc8d28d77495..cb849bcf61ae 100644
>> --- a/block/bdev.c
>> +++ b/block/bdev.c
>> @@ -408,10 +408,10 @@ struct block_device *bdev_alloc(struct gendisk 
>> *disk, u8 partno)
>>       bdev->bd_partno = partno;
>>       bdev->bd_inode = inode;
>>       bdev->bd_queue = disk->queue;
>> -    if (partno)
>> -        bdev->bd_has_submit_bio = disk->part0->bd_has_submit_bio;
>> +    if (partno && test_bit(BD_FLAG_HAS_SUBMIT_BIO, &disk->part0->flags))
>> +        set_bit(BD_FLAG_HAS_SUBMIT_BIO, &bdev->flags);
>>       else
>> -        bdev->bd_has_submit_bio = false;
>> +        clear_bit(BD_FLAG_HAS_SUBMIT_BIO, &bdev->flags);
>>       bdev->bd_stats = alloc_percpu(struct disk_stats);
>>       if (!bdev->bd_stats) {
>>           iput(inode);
> 
> Couldn't you achieve the very same result by using 
> 'READ_ONCE()/WRITE_ONCE()' and keep the structure as-is?

Yes, remove this patch and add a new bool field in the next patch can
work as well, the idea here is replace multiple fields with a single
flag, and just use the flag in next patch. If people thinks add a new
bool field is better, I'll follow that.

Thanks,
Kuai

> 
> Cheers,
> 
> Hannes--
> Dr. Hannes Reinecke                   Kernel Storage Architect
> hare@...e.de                              +49 911 74053 688
> SUSE Software Solutions Germany GmbH, Frankenstr. 146, 90461 Nürnberg
> Managing Directors: I. Totev, A. McDonald, W. Knoblich
> (HRB 36809, AG Nürnberg)
> 
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ