[PATCH v14 00/10] Support persistent reservation operations

Changqi Lu posted 10 patches 1 year, 4 months ago
Failed in applying to current master (apply log)
block/block-backend.c             | 403 ++++++++++++++++++++++++++++
block/io.c                        | 164 ++++++++++++
block/iscsi.c                     | 428 ++++++++++++++++++++++++++++++
block/raw-format.c                |  56 ++++
hw/nvme/ctrl.c                    | 350 +++++++++++++++++++++++-
hw/nvme/ns.c                      |  11 +
hw/nvme/nvme.h                    |  93 +++++++
hw/scsi/scsi-disk.c               | 374 ++++++++++++++++++++++++++
include/block/block-common.h      |  40 +++
include/block/block-io.h          |  20 ++
include/block/block_int-common.h  |  84 ++++++
include/block/nvme.h              | 121 ++++++++-
include/scsi/constants.h          |  52 ++++
include/scsi/utils.h              |   8 +
include/sysemu/block-backend-io.h |  24 ++
scsi/utils.c                      |  81 ++++++
16 files changed, 2307 insertions(+), 2 deletions(-)
[PATCH v14 00/10] Support persistent reservation operations
Posted by Changqi Lu 1 year, 4 months ago
Patch v14 has been modified, thanks to Stefan for the code review.

v13->v14:
- Fix some protocol and spelling related issues at hw/nvme/ctrl.c.

v12->v13:
- Fix byte swaps at hw/nvme/ctrl.c.

v11->v12:
- Fixed endian conversion during command parsing;
- Add the maximum number of keys, currently limited to 128.

v10->v11:
- Before executing the pr operation, check whether it is supported.
  If it is not supported, return NVME_INVALID_OPCODE directly.

v9->v10:
- When the driver does not support the pr operation, the error
  code returned by nvme changes to Invalid Command Opcode.

v8->v9:
- Fix double-free and remove persistent reservation operations at nvme_is_write().

v7->v8:
- Fix num_keys may be less than 0 at scsi_pr_read_keys_complete().
- Fix buf memory leak at iscsi driver.

v6->v7:
- Add buferlen size check at SCSI layer.
- Add pr_cap calculation in bdrv_merge_limits() function at block layer,
  so the ugly bs->file->bs->bl.pr_cap in scsi and nvme layers was
  changed to bs->bl.pr_cap.
- Fix memory leak at iscsi driver, and some other spelling errors.

v5->v6:
- Add relevant comments in the io layer.

v4->v5:
- Fixed a memory leak bug at hw/nvme/ctrl.c.

v3->v4:
- At the nvme layer, the two patches of enabling the ONCS
  function and enabling rescap are combined into one.
- At the nvme layer, add helper functions for pr capacity
  conversion between the block layer and the nvme layer.

v2->v3:
In v2 Persist Through Power Loss(PTPL) is enable default.
In v3 PTPL is supported, which is passed as a parameter.

v1->v2:
- Add sg_persist --report-capabilities for SCSI protocol and enable
  oncs and rescap for NVMe protocol.
- Add persistent reservation capabilities constants and helper functions for
  SCSI and NVMe protocol.
- Add comments for necessary APIs.

v1:
- Add seven APIs about persistent reservation command for block layer.
  These APIs including reading keys, reading reservations, registering,
  reserving, releasing, clearing and preempting.
- Add the necessary pr-related operation APIs for both the
  SCSI protocol and NVMe protocol at the device layer.
- Add scsi driver at the driver layer to verify the functions

Changqi Lu (10):
  block: add persistent reservation in/out api
  block/raw: add persistent reservation in/out driver
  scsi/constant: add persistent reservation in/out protocol constants
  scsi/util: add helper functions for persistent reservation types
    conversion
  hw/scsi: add persistent reservation in/out api for scsi device
  block/nvme: add reservation command protocol constants
  hw/nvme: add helper functions for converting reservation types
  hw/nvme: enable ONCS and rescap function
  hw/nvme: add reservation protocal command
  block/iscsi: add persistent reservation in/out driver

 block/block-backend.c             | 403 ++++++++++++++++++++++++++++
 block/io.c                        | 164 ++++++++++++
 block/iscsi.c                     | 428 ++++++++++++++++++++++++++++++
 block/raw-format.c                |  56 ++++
 hw/nvme/ctrl.c                    | 350 +++++++++++++++++++++++-
 hw/nvme/ns.c                      |  11 +
 hw/nvme/nvme.h                    |  93 +++++++
 hw/scsi/scsi-disk.c               | 374 ++++++++++++++++++++++++++
 include/block/block-common.h      |  40 +++
 include/block/block-io.h          |  20 ++
 include/block/block_int-common.h  |  84 ++++++
 include/block/nvme.h              | 121 ++++++++-
 include/scsi/constants.h          |  52 ++++
 include/scsi/utils.h              |   8 +
 include/sysemu/block-backend-io.h |  24 ++
 scsi/utils.c                      |  81 ++++++
 16 files changed, 2307 insertions(+), 2 deletions(-)

-- 
2.20.1
Re: [PATCH v14 00/10] Support persistent reservation operations
Posted by Alberto Faria 2 months, 4 weeks ago
Hi Changqi,

I wonder if you plan on following through with this series? It looks
like it was/is very close to being merged. I can help or pick it up
from here if you want, as I'm interested in seeing it merged.

Thanks, Alberto

On Fri, Oct 11, 2024 at 6:24 PM Changqi Lu <luchangqi.123@bytedance.com> wrote:
>
> Patch v14 has been modified, thanks to Stefan for the code review.
>
> v13->v14:
> - Fix some protocol and spelling related issues at hw/nvme/ctrl.c.
>
> v12->v13:
> - Fix byte swaps at hw/nvme/ctrl.c.
>
> v11->v12:
> - Fixed endian conversion during command parsing;
> - Add the maximum number of keys, currently limited to 128.
>
> v10->v11:
> - Before executing the pr operation, check whether it is supported.
>   If it is not supported, return NVME_INVALID_OPCODE directly.
>
> v9->v10:
> - When the driver does not support the pr operation, the error
>   code returned by nvme changes to Invalid Command Opcode.
>
> v8->v9:
> - Fix double-free and remove persistent reservation operations at nvme_is_write().
>
> v7->v8:
> - Fix num_keys may be less than 0 at scsi_pr_read_keys_complete().
> - Fix buf memory leak at iscsi driver.
>
> v6->v7:
> - Add buferlen size check at SCSI layer.
> - Add pr_cap calculation in bdrv_merge_limits() function at block layer,
>   so the ugly bs->file->bs->bl.pr_cap in scsi and nvme layers was
>   changed to bs->bl.pr_cap.
> - Fix memory leak at iscsi driver, and some other spelling errors.
>
> v5->v6:
> - Add relevant comments in the io layer.
>
> v4->v5:
> - Fixed a memory leak bug at hw/nvme/ctrl.c.
>
> v3->v4:
> - At the nvme layer, the two patches of enabling the ONCS
>   function and enabling rescap are combined into one.
> - At the nvme layer, add helper functions for pr capacity
>   conversion between the block layer and the nvme layer.
>
> v2->v3:
> In v2 Persist Through Power Loss(PTPL) is enable default.
> In v3 PTPL is supported, which is passed as a parameter.
>
> v1->v2:
> - Add sg_persist --report-capabilities for SCSI protocol and enable
>   oncs and rescap for NVMe protocol.
> - Add persistent reservation capabilities constants and helper functions for
>   SCSI and NVMe protocol.
> - Add comments for necessary APIs.
>
> v1:
> - Add seven APIs about persistent reservation command for block layer.
>   These APIs including reading keys, reading reservations, registering,
>   reserving, releasing, clearing and preempting.
> - Add the necessary pr-related operation APIs for both the
>   SCSI protocol and NVMe protocol at the device layer.
> - Add scsi driver at the driver layer to verify the functions
>
> Changqi Lu (10):
>   block: add persistent reservation in/out api
>   block/raw: add persistent reservation in/out driver
>   scsi/constant: add persistent reservation in/out protocol constants
>   scsi/util: add helper functions for persistent reservation types
>     conversion
>   hw/scsi: add persistent reservation in/out api for scsi device
>   block/nvme: add reservation command protocol constants
>   hw/nvme: add helper functions for converting reservation types
>   hw/nvme: enable ONCS and rescap function
>   hw/nvme: add reservation protocal command
>   block/iscsi: add persistent reservation in/out driver
>
>  block/block-backend.c             | 403 ++++++++++++++++++++++++++++
>  block/io.c                        | 164 ++++++++++++
>  block/iscsi.c                     | 428 ++++++++++++++++++++++++++++++
>  block/raw-format.c                |  56 ++++
>  hw/nvme/ctrl.c                    | 350 +++++++++++++++++++++++-
>  hw/nvme/ns.c                      |  11 +
>  hw/nvme/nvme.h                    |  93 +++++++
>  hw/scsi/scsi-disk.c               | 374 ++++++++++++++++++++++++++
>  include/block/block-common.h      |  40 +++
>  include/block/block-io.h          |  20 ++
>  include/block/block_int-common.h  |  84 ++++++
>  include/block/nvme.h              | 121 ++++++++-
>  include/scsi/constants.h          |  52 ++++
>  include/scsi/utils.h              |   8 +
>  include/sysemu/block-backend-io.h |  24 ++
>  scsi/utils.c                      |  81 ++++++
>  16 files changed, 2307 insertions(+), 2 deletions(-)
>
> --
> 2.20.1
>
>
Re: [PATCH v14 00/10] Support persistent reservation operations
Posted by Alberto Faria 2 months, 4 weeks ago
It seems Changqi Lu might have left ByteDance, the email is bouncing
with a user not found error.

Any tips on how to proceed?

Alberto

On Wed, Nov 12, 2025 at 10:26 AM Alberto Faria <afaria@redhat.com> wrote:
>
> Hi Changqi,
>
> I wonder if you plan on following through with this series? It looks
> like it was/is very close to being merged. I can help or pick it up
> from here if you want, as I'm interested in seeing it merged.
>
> Thanks, Alberto
>
> On Fri, Oct 11, 2024 at 6:24 PM Changqi Lu <luchangqi.123@bytedance.com> wrote:
> >
> > Patch v14 has been modified, thanks to Stefan for the code review.
> >
> > v13->v14:
> > - Fix some protocol and spelling related issues at hw/nvme/ctrl.c.
> >
> > v12->v13:
> > - Fix byte swaps at hw/nvme/ctrl.c.
> >
> > v11->v12:
> > - Fixed endian conversion during command parsing;
> > - Add the maximum number of keys, currently limited to 128.
> >
> > v10->v11:
> > - Before executing the pr operation, check whether it is supported.
> >   If it is not supported, return NVME_INVALID_OPCODE directly.
> >
> > v9->v10:
> > - When the driver does not support the pr operation, the error
> >   code returned by nvme changes to Invalid Command Opcode.
> >
> > v8->v9:
> > - Fix double-free and remove persistent reservation operations at nvme_is_write().
> >
> > v7->v8:
> > - Fix num_keys may be less than 0 at scsi_pr_read_keys_complete().
> > - Fix buf memory leak at iscsi driver.
> >
> > v6->v7:
> > - Add buferlen size check at SCSI layer.
> > - Add pr_cap calculation in bdrv_merge_limits() function at block layer,
> >   so the ugly bs->file->bs->bl.pr_cap in scsi and nvme layers was
> >   changed to bs->bl.pr_cap.
> > - Fix memory leak at iscsi driver, and some other spelling errors.
> >
> > v5->v6:
> > - Add relevant comments in the io layer.
> >
> > v4->v5:
> > - Fixed a memory leak bug at hw/nvme/ctrl.c.
> >
> > v3->v4:
> > - At the nvme layer, the two patches of enabling the ONCS
> >   function and enabling rescap are combined into one.
> > - At the nvme layer, add helper functions for pr capacity
> >   conversion between the block layer and the nvme layer.
> >
> > v2->v3:
> > In v2 Persist Through Power Loss(PTPL) is enable default.
> > In v3 PTPL is supported, which is passed as a parameter.
> >
> > v1->v2:
> > - Add sg_persist --report-capabilities for SCSI protocol and enable
> >   oncs and rescap for NVMe protocol.
> > - Add persistent reservation capabilities constants and helper functions for
> >   SCSI and NVMe protocol.
> > - Add comments for necessary APIs.
> >
> > v1:
> > - Add seven APIs about persistent reservation command for block layer.
> >   These APIs including reading keys, reading reservations, registering,
> >   reserving, releasing, clearing and preempting.
> > - Add the necessary pr-related operation APIs for both the
> >   SCSI protocol and NVMe protocol at the device layer.
> > - Add scsi driver at the driver layer to verify the functions
> >
> > Changqi Lu (10):
> >   block: add persistent reservation in/out api
> >   block/raw: add persistent reservation in/out driver
> >   scsi/constant: add persistent reservation in/out protocol constants
> >   scsi/util: add helper functions for persistent reservation types
> >     conversion
> >   hw/scsi: add persistent reservation in/out api for scsi device
> >   block/nvme: add reservation command protocol constants
> >   hw/nvme: add helper functions for converting reservation types
> >   hw/nvme: enable ONCS and rescap function
> >   hw/nvme: add reservation protocal command
> >   block/iscsi: add persistent reservation in/out driver
> >
> >  block/block-backend.c             | 403 ++++++++++++++++++++++++++++
> >  block/io.c                        | 164 ++++++++++++
> >  block/iscsi.c                     | 428 ++++++++++++++++++++++++++++++
> >  block/raw-format.c                |  56 ++++
> >  hw/nvme/ctrl.c                    | 350 +++++++++++++++++++++++-
> >  hw/nvme/ns.c                      |  11 +
> >  hw/nvme/nvme.h                    |  93 +++++++
> >  hw/scsi/scsi-disk.c               | 374 ++++++++++++++++++++++++++
> >  include/block/block-common.h      |  40 +++
> >  include/block/block-io.h          |  20 ++
> >  include/block/block_int-common.h  |  84 ++++++
> >  include/block/nvme.h              | 121 ++++++++-
> >  include/scsi/constants.h          |  52 ++++
> >  include/scsi/utils.h              |   8 +
> >  include/sysemu/block-backend-io.h |  24 ++
> >  scsi/utils.c                      |  81 ++++++
> >  16 files changed, 2307 insertions(+), 2 deletions(-)
> >
> > --
> > 2.20.1
> >
> >