On 24/06/2025 15:09, Christoph Hellwig wrote:
On Wed, Jun 18, 2025 at 07:28:19AM +0100, John Garry wrote:
On 18/06/2025 06:08, Christoph Hellwig wrote:
- struct xfs_groups *rgs = &mp->m_groups[XG_TYPE_RTG];
+ struct xfs_groups *g = &mp->m_groups[type];
+ struct xfs_buftarg *btp = type == XG_TYPE_RTG ?
+ mp->m_rtdev_targp : mp->m_ddev_targp;
Could this be made a bit more readable?
Suggestions welcome.
I thought that you did not like the ternary operator :)
Using an if-else would bloat the code, so I suppose what you have is ok.
Initializing variables at declaration time is one of the few sane-ish
use cases for it. Although maybe a little helpers might be even better.
As you prob noticed, xfs_dax_notify_dev_failure() and (effectively)
xfs_group_bdev() has this same pattern.