Re: [PATCH 3/3] storage: Clean up volume wiping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 01, 2016 at 11:10:19AM -0400, John Ferlan wrote:
On 08/01/2016 09:12 AM, Martin Kletzander wrote:
Let's cleanly differentiate what wiping a volume does for ploop and
other volumes so it's more readable what is done for each one instead of
branching out multiple times in different parts of the same function.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/storage/storage_backend.c | 78 ++++++++++++++++++++++++-------------------
 1 file changed, 44 insertions(+), 34 deletions(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index b7c7af298f29..27a757edec73 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -2499,26 +2481,23 @@ virStorageBackendVolWipeLocal(virConnectPtr conn ATTRIBUTE_UNUSED,
         } else {
             ret = virStorageBackendWipeLocal(path,
                                              fd,
-                                             vol->target.allocation,
+                                             allocation,
                                              st.st_blksize);
         }
         if (ret < 0)
             goto cleanup;
     }

-    if (vol->target.format == VIR_STORAGE_FILE_PLOOP)
-        ret = virStorageBackendVolWipePloop(vol);
-
  cleanup:
     virCommandFree(cmd);
-    VIR_FREE(path);
     VIR_FORCE_CLOSE(fd);
     return ret;
 }


 static int
-virStorageBackendVolWipePloop(virStorageVolDefPtr vol)
+virStorageBackendVolWipePloop(virStorageVolDefPtr vol,
+                              unsigned int algorithm)


Ironically... this could take "path", "allocation", and "capacity" as
parameters instead of "vol"....


I don't see the reason for that now as it won't be available from

Your call on adjusting this one as well...  If you do, you should adjust
the odd vertical alignment for the virCommandAddArgFormat for
VIR_DIV_UP(capacity,...)


I adjusted that though.  Let's have it clean.  I'll push it after release.

Martin

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]