Re: [PATCH 3/5] storage: drop 'Extent' from virStorageBackendWipeExtentLocal

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

 




On 12/11/2015 11:36 AM, Ján Tomko wrote:
> The only caller always passes 0 for the extent start.
> Drop the 'extent_start' parameter, as well as the mention of extents
> from the function name.
> ---
>  src/storage/storage_backend.c | 32 +++++++++++++++-----------------
>  1 file changed, 15 insertions(+), 17 deletions(-)
> 

I think 3 & 4 could be combined - since you're removing extent_start
anyway as part of the same change...

The extent_length/wipe_len is already an unsigned long long (from
target.allocation) - so that's just part of fixing the function as far
as I'm concerned.

If you want to keep them separate I'm not going to complain either.

John
> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
> index 120d654..d1276dd 100644
> --- a/src/storage/storage_backend.c
> +++ b/src/storage/storage_backend.c
> @@ -1987,29 +1987,28 @@ virStorageBackendVolZeroSparseFileLocal(virStorageVolDefPtr vol,
>  
>  
>  static int
> -virStorageBackendWipeExtentLocal(virStorageVolDefPtr vol,
> -                                 int fd,
> -                                 off_t extent_start,
> -                                 off_t extent_length,
> -                                 size_t writebuf_length,
> -                                 size_t *bytes_wiped)
> +virStorageBackendWipeLocal(virStorageVolDefPtr vol,
> +                           int fd,
> +                           off_t extent_length,
> +                           size_t writebuf_length,
> +                           size_t *bytes_wiped)
>  {
>      int ret = -1, written = 0;
>      off_t remaining = 0;
>      size_t write_size = 0;
>      char *writebuf = NULL;
>  
> -    VIR_DEBUG("extent logical start: %ju len: %ju",
> -              (uintmax_t)extent_start, (uintmax_t)extent_length);
> +    VIR_DEBUG("extent logical start: 0 len: %ju",
> +              (uintmax_t)extent_length);
>  
>      if (VIR_ALLOC_N(writebuf, writebuf_length) < 0)
>          goto cleanup;
>  
> -    if (lseek(fd, extent_start, SEEK_SET) < 0) {
> +    if (lseek(fd, 0, SEEK_SET) < 0) {
>          virReportSystemError(errno,
> -                             _("Failed to seek to position %ju in volume "
> +                             _("Failed to seek to the start in volume "
>                                 "with path '%s'"),
> -                             (uintmax_t)extent_start, vol->target.path);
> +                             vol->target.path);
>          goto cleanup;
>      }
>  
> @@ -2126,12 +2125,11 @@ virStorageBackendVolWipeLocal(virConnectPtr conn ATTRIBUTE_UNUSED,
>          if (S_ISREG(st.st_mode) && st.st_blocks < (st.st_size / DEV_BSIZE)) {
>              ret = virStorageBackendVolZeroSparseFileLocal(vol, st.st_size, fd);
>          } else {
> -            ret = virStorageBackendWipeExtentLocal(vol,
> -                                                   fd,
> -                                                   0,
> -                                                   vol->target.allocation,
> -                                                   st.st_blksize,
> -                                                   &bytes_wiped);
> +            ret = virStorageBackendWipeLocal(vol,
> +                                             fd,
> +                                             vol->target.allocation,
> +                                             st.st_blksize,
> +                                             &bytes_wiped);
>          }
>      }
>  
> 

--
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]