Re: [PATCH v2 7/7] cxl/region: Drop goto pattern of construct_region()

From: Jonathan Cameron
Date: Tue Feb 18 2025 - 12:25:47 EST


On Mon, 17 Feb 2025 22:48:28 +0800
Li Ming <ming.li@xxxxxxxxxxxx> wrote:

> Some operations need to be protected by the cxl_region_rwsem in
> construct_region(). Currently, construct_region() uses down_write() and
> up_write() for the cxl_region_rwsem locking, so there is a goto pattern
> after down_write() invoked to release cxl_region_rwsem.
>
> construct region() can be optimized to remove the goto pattern. The
> changes are creating a new function called construct_auto_region() which
> will include all checking and operations protected by the
> cxl_region_rwsem, and using guard(rwsem_write) to replace down_write()
> and up_write() in construct_auto_region().
>
> Signed-off-by: Li Ming <ming.li@xxxxxxxxxxxx>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>