public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Yang Xiuwei <yangxiuwei@kylinos.cn>
To: bvanassche@acm.org
Cc: axboe@kernel.dk, fujita.tomonori@lab.ntt.co.jp,
	James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com, linux-block@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH v7 2/3] bsg: add io_uring command support to generic layer
Date: Fri, 13 Mar 2026 15:34:14 +0800	[thread overview]
Message-ID: <20260313073415.102437-2-yangxiuwei@kylinos.cn> (raw)
In-Reply-To: <96545a0f-2cdf-47ae-bf15-bfb33a35c799@acm.org>

Hi Bart,

On 3/12/26 7:33 PM, Bart Van Assche wrote:
> On 3/12/26 2:22 AM, Yang Xiuwei wrote:
>> +static int bsg_uring_cmd(struct io_uring_cmd *ioucmd, unsigned int issue_flags)
>> +{
>> +	struct request_queue *q;
>> +	struct bsg_device *bd;
>> +	bool open_for_write = ioucmd->file->f_mode & FMODE_WRITE;
>> +	int ret;
>> +
>> +	bd = to_bsg_device(file_inode(ioucmd->file));
>> +	q = bd->queue;
>>
>> Please combine the above assignments with the declarations of the
>> modified variables.
>

To follow your suggestion, I now combine the declarations with the
initializations, but I had to keep the dependency order between `bd`
and `q`, since `q` is initialized from `bd->queue`. The current version
looks like this:

        struct bsg_device *bd = to_bsg_device(file_inode(ioucmd->file));
        bool open_for_write = ioucmd->file->f_mode & FMODE_WRITE;
        struct request_queue *q = bd->queue;
        int ret;
		
This way we respect the declaration+initialization style and keep the
data dependency clear, while following the reverse Christmas tree style
as far as it does not conflict with the dependency.
Does this arrangement look reasonable to you, or would you prefer a
different ordering here?

Thanks,
Yang Xiuwei


  reply	other threads:[~2026-03-13  7:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-12  9:22 [PATCH v7 0/3] bsg: add io_uring command support for SCSI passthrough Yang Xiuwei
2026-03-12  9:22 ` [PATCH v7 1/3] bsg: add bsg_uring_cmd uapi structure Yang Xiuwei
2026-03-12 19:29   ` Bart Van Assche
2026-03-13  7:34     ` Yang Xiuwei
2026-03-13 15:34       ` Bart Van Assche
2026-03-12  9:22 ` [PATCH v7 2/3] bsg: add io_uring command support to generic layer Yang Xiuwei
2026-03-12 19:33   ` Bart Van Assche
2026-03-13  7:34     ` Yang Xiuwei [this message]
2026-03-13 15:35       ` Bart Van Assche
2026-03-12  9:22 ` [PATCH v7 3/3] scsi: bsg: add io_uring passthrough handler Yang Xiuwei
2026-03-12 19:41   ` Bart Van Assche
2026-03-13  7:34     ` Yang Xiuwei
2026-03-13 15:37       ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260313073415.102437-2-yangxiuwei@kylinos.cn \
    --to=yangxiuwei@kylinos.cn \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox