Commit e39ea3a
committed
rbd: avoid GetTrashList in ensureImageCleanup by using ImageID
ensureImageCleanup() previously called librbd.GetTrashList() and
matched the image by name to obtain its ID. Since ImageID is already
populated from the journal at all call sites, use it directly and call
trashRemoveImage() without the expensive list operation. ENOENT is
treated as success for idempotency (image already cleaned up).
The one path where ImageID may be absent is DeleteTempImage(): when
Delete() fails with ErrImageNotFound because the temp-clone is already
in trash (opened by name fails), ImageID is not set. A new helper
findImageIDInTrash() performs the GetTrashList fallback only in that
exceptional retry scenario and populates ImageID before calling
ensureImageCleanup().
Assisted-by: Claude Code <noreply@anthropic.com>
Signed-off-by: Niels de Vos <ndevos@ibm.com>1 parent 978d106 commit e39ea3a
1 file changed
Lines changed: 44 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
720 | 720 | | |
721 | 721 | | |
722 | 722 | | |
723 | | - | |
724 | | - | |
| 723 | + | |
| 724 | + | |
725 | 725 | | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
726 | 730 | | |
727 | 731 | | |
728 | 732 | | |
729 | 733 | | |
730 | 734 | | |
731 | | - | |
732 | | - | |
733 | | - | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
734 | 739 | | |
735 | | - | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
736 | 748 | | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | 749 | | |
741 | | - | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
742 | 760 | | |
743 | 761 | | |
744 | 762 | | |
745 | | - | |
| 763 | + | |
746 | 764 | | |
747 | 765 | | |
748 | 766 | | |
| |||
848 | 866 | | |
849 | 867 | | |
850 | 868 | | |
851 | | - | |
852 | | - | |
853 | | - | |
854 | | - | |
| 869 | + | |
855 | 870 | | |
856 | 871 | | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
857 | 886 | | |
858 | 887 | | |
859 | 888 | | |
| |||
0 commit comments