Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: "Ionut Nechita (Wind River)" <ionut.nechita@windriver.com>,
	linux-scsi@vger.kernel.org
Cc: James.Bottomley@HansenPartnership.com, ahuang12@lenovo.com,
	axboe@kernel.dk, hch@lst.de, ionut_n2001@yahoo.com,
	john.g.garry@oracle.com, linux-kernel@vger.kernel.org,
	m.szyprowski@samsung.com, martin.petersen@oracle.com,
	robin.murphy@arm.com, sunlightlinux@gmail.com
Subject: Re: [PATCH v4] scsi: sas: skip opt_sectors when DMA reports no real optimization hint
Date: Thu, 19 Mar 2026 20:07:07 +0900	[thread overview]
Message-ID: <6a78fcaa-7a3e-423f-b6f5-84cd66a3c88f@kernel.org> (raw)
In-Reply-To: <20260319083954.21056-2-ionut.nechita@windriver.com>

On 3/19/26 17:39, Ionut Nechita (Wind River) wrote:
> +static unsigned int sas_dma_opt_sectors(struct device *dma_dev,
> +					unsigned int max_sectors)
> +{
> +	size_t opt = dma_opt_mapping_size(dma_dev);
> +	size_t max = dma_max_mapping_size(dma_dev);
> +
> +	if (WARN_ONCE(opt > max,
> +		      "dma_opt_mapping_size (%zu) > dma_max_mapping_size (%zu)\n",
> +		      opt, max))
> +		return 0;
> +
> +	if (opt == max)
> +		return 0;

Why return 0 ? This is a valid case, so this should get through the alignment below.

> +
> +	opt = rounddown_pow_of_two(opt);
> +
> +	return min_t(unsigned int, opt >> SECTOR_SHIFT, max_sectors);
> +}
> +


-- 
Damien Le Moal
Western Digital Research

  parent reply	other threads:[~2026-03-19 11:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19  8:39 [PATCH v4 0/1] scsi: sas: fix mkfs.xfs failure due to bogus optimal_io_size Ionut Nechita (Wind River)
2026-03-19  8:39 ` [PATCH v4] scsi: sas: skip opt_sectors when DMA reports no real optimization hint Ionut Nechita (Wind River)
2026-03-19 11:06   ` Damien Le Moal
2026-03-19 11:07   ` Damien Le Moal [this message]
2026-03-19 20:43     ` Ionut Nechita (Wind River)
2026-03-19 20:49       ` Damien Le Moal
2026-03-19 21:04       ` James Bottomley

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=6a78fcaa-7a3e-423f-b6f5-84cd66a3c88f@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=ahuang12@lenovo.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=ionut.nechita@windriver.com \
    --cc=ionut_n2001@yahoo.com \
    --cc=john.g.garry@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=martin.petersen@oracle.com \
    --cc=robin.murphy@arm.com \
    --cc=sunlightlinux@gmail.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