diff mbox

[1/5] migration: Remove unused functions

Message ID 1424365943-27563-2-git-send-email-thuth@linux.vnet.ibm.com
State New
Headers show

Commit Message

Thomas Huth Feb. 19, 2015, 5:12 p.m. UTC
dup_mig_bytes_transferred(), skipped_mig_bytes_transferred(),
migrate_rdma_pin_all(), qsb_clone() and qsb_set_length()
are completely unused and thus can be deleted.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Cc: Juan Quintela <quintela@redhat.com>
Cc: Amit Shah <amit.shah@redhat.com>
---
 arch_init.c                   |   10 -------
 include/migration/migration.h |    3 --
 include/migration/qemu-file.h |    2 -
 migration/migration.c         |    9 -------
 migration/qemu-file-buf.c     |   53 -----------------------------------------
 5 files changed, 0 insertions(+), 77 deletions(-)

Comments

Amit Shah Feb. 24, 2015, 9:28 a.m. UTC | #1
On (Thu) 19 Feb 2015 [18:12:19], Thomas Huth wrote:
> dup_mig_bytes_transferred(), skipped_mig_bytes_transferred(),
> migrate_rdma_pin_all(), qsb_clone() and qsb_set_length()
> are completely unused and thus can be deleted.
> 
> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> Cc: Juan Quintela <quintela@redhat.com>
> Cc: Amit Shah <amit.shah@redhat.com>
> ---
>  arch_init.c                   |   10 -------
>  include/migration/migration.h |    3 --
>  include/migration/qemu-file.h |    2 -
>  migration/migration.c         |    9 -------
>  migration/qemu-file-buf.c     |   53 -----------------------------------------
>  5 files changed, 0 insertions(+), 77 deletions(-)
> 
> diff --git a/arch_init.c b/arch_init.c
> index 89c8fa4..ad5ce28 100644
> --- a/arch_init.c
> +++ b/arch_init.c
> @@ -249,21 +249,11 @@ static void acct_clear(void)
>      memset(&acct_info, 0, sizeof(acct_info));
>  }
>  
> -uint64_t dup_mig_bytes_transferred(void)
> -{
> -    return acct_info.dup_pages * TARGET_PAGE_SIZE;
> -}
> -
>  uint64_t dup_mig_pages_transferred(void)
>  {
>      return acct_info.dup_pages;
>  }
>  
> -uint64_t skipped_mig_bytes_transferred(void)
> -{
> -    return acct_info.skipped_pages * TARGET_PAGE_SIZE;
> -}

These could be used for reporting; Juan, any idea why these aren't
used?

Rest of the patch is fine.

		Amit
Thomas Huth Feb. 24, 2015, 4:28 p.m. UTC | #2
On Tue, 24 Feb 2015 14:58:29 +0530
Amit Shah <amit.shah@redhat.com> wrote:

> On (Thu) 19 Feb 2015 [18:12:19], Thomas Huth wrote:
> > dup_mig_bytes_transferred(), skipped_mig_bytes_transferred(),
> > migrate_rdma_pin_all(), qsb_clone() and qsb_set_length()
> > are completely unused and thus can be deleted.
> > 
> > Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> > Cc: Juan Quintela <quintela@redhat.com>
> > Cc: Amit Shah <amit.shah@redhat.com>
> > ---
> >  arch_init.c                   |   10 -------
> >  include/migration/migration.h |    3 --
> >  include/migration/qemu-file.h |    2 -
> >  migration/migration.c         |    9 -------
> >  migration/qemu-file-buf.c     |   53 -----------------------------------------
> >  5 files changed, 0 insertions(+), 77 deletions(-)
> > 
> > diff --git a/arch_init.c b/arch_init.c
> > index 89c8fa4..ad5ce28 100644
> > --- a/arch_init.c
> > +++ b/arch_init.c
> > @@ -249,21 +249,11 @@ static void acct_clear(void)
> >      memset(&acct_info, 0, sizeof(acct_info));
> >  }
> >  
> > -uint64_t dup_mig_bytes_transferred(void)
> > -{
> > -    return acct_info.dup_pages * TARGET_PAGE_SIZE;
> > -}
> > -
> >  uint64_t dup_mig_pages_transferred(void)
> >  {
> >      return acct_info.dup_pages;
> >  }
> >  
> > -uint64_t skipped_mig_bytes_transferred(void)
> > -{
> > -    return acct_info.skipped_pages * TARGET_PAGE_SIZE;
> > -}
> 
> These could be used for reporting; Juan, any idea why these aren't
> used?

Since they are very trivial, I think they could easily be re-added
again in case they are needed again in the future.
Or if you prefer, I can also rework my patch so that these two
functions won't get deleted.

 Thomas
Amit Shah March 2, 2015, 6:44 a.m. UTC | #3
On (Tue) 24 Feb 2015 [17:28:36], Thomas Huth wrote:
> On Tue, 24 Feb 2015 14:58:29 +0530
> Amit Shah <amit.shah@redhat.com> wrote:
> 
> > On (Thu) 19 Feb 2015 [18:12:19], Thomas Huth wrote:
> > > dup_mig_bytes_transferred(), skipped_mig_bytes_transferred(),
> > > migrate_rdma_pin_all(), qsb_clone() and qsb_set_length()
> > > are completely unused and thus can be deleted.
> > > 
> > > Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
> > > Cc: Juan Quintela <quintela@redhat.com>
> > > Cc: Amit Shah <amit.shah@redhat.com>
> > > ---
> > >  arch_init.c                   |   10 -------
> > >  include/migration/migration.h |    3 --
> > >  include/migration/qemu-file.h |    2 -
> > >  migration/migration.c         |    9 -------
> > >  migration/qemu-file-buf.c     |   53 -----------------------------------------
> > >  5 files changed, 0 insertions(+), 77 deletions(-)
> > > 
> > > diff --git a/arch_init.c b/arch_init.c
> > > index 89c8fa4..ad5ce28 100644
> > > --- a/arch_init.c
> > > +++ b/arch_init.c
> > > @@ -249,21 +249,11 @@ static void acct_clear(void)
> > >      memset(&acct_info, 0, sizeof(acct_info));
> > >  }
> > >  
> > > -uint64_t dup_mig_bytes_transferred(void)
> > > -{
> > > -    return acct_info.dup_pages * TARGET_PAGE_SIZE;
> > > -}
> > > -
> > >  uint64_t dup_mig_pages_transferred(void)
> > >  {
> > >      return acct_info.dup_pages;
> > >  }
> > >  
> > > -uint64_t skipped_mig_bytes_transferred(void)
> > > -{
> > > -    return acct_info.skipped_pages * TARGET_PAGE_SIZE;
> > > -}
> > 
> > These could be used for reporting; Juan, any idea why these aren't
> > used?
> 
> Since they are very trivial, I think they could easily be re-added
> again in case they are needed again in the future.
> Or if you prefer, I can also rework my patch so that these two
> functions won't get deleted.

I'm just asking Juan if he knows why these are around; I don't mind if
we get rid of them, but good to get confirmation from Juan (else we
needlessly end up churning code).

		Amit
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index 89c8fa4..ad5ce28 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -249,21 +249,11 @@  static void acct_clear(void)
     memset(&acct_info, 0, sizeof(acct_info));
 }
 
-uint64_t dup_mig_bytes_transferred(void)
-{
-    return acct_info.dup_pages * TARGET_PAGE_SIZE;
-}
-
 uint64_t dup_mig_pages_transferred(void)
 {
     return acct_info.dup_pages;
 }
 
-uint64_t skipped_mig_bytes_transferred(void)
-{
-    return acct_info.skipped_pages * TARGET_PAGE_SIZE;
-}
-
 uint64_t skipped_mig_pages_transferred(void)
 {
     return acct_info.skipped_pages;
diff --git a/include/migration/migration.h b/include/migration/migration.h
index f37348b..7f6cdaa 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -115,9 +115,7 @@  void free_xbzrle_decoded_buf(void);
 
 void acct_update_position(QEMUFile *f, size_t size, bool zero);
 
-uint64_t dup_mig_bytes_transferred(void);
 uint64_t dup_mig_pages_transferred(void);
-uint64_t skipped_mig_bytes_transferred(void);
 uint64_t skipped_mig_pages_transferred(void);
 uint64_t norm_mig_bytes_transferred(void);
 uint64_t norm_mig_pages_transferred(void);
@@ -143,7 +141,6 @@  void migrate_add_blocker(Error *reason);
  */
 void migrate_del_blocker(Error *reason);
 
-bool migrate_rdma_pin_all(void);
 bool migrate_zero_blocks(void);
 
 bool migrate_auto_converge(void);
diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h
index a923cec..45d7f71 100644
--- a/include/migration/qemu-file.h
+++ b/include/migration/qemu-file.h
@@ -133,9 +133,7 @@  bool qemu_file_mode_is_not_valid(const char *mode);
 bool qemu_file_is_writable(QEMUFile *f);
 
 QEMUSizedBuffer *qsb_create(const uint8_t *buffer, size_t len);
-QEMUSizedBuffer *qsb_clone(const QEMUSizedBuffer *);
 void qsb_free(QEMUSizedBuffer *);
-size_t qsb_set_length(QEMUSizedBuffer *qsb, size_t length);
 size_t qsb_get_length(const QEMUSizedBuffer *qsb);
 ssize_t qsb_get_buffer(const QEMUSizedBuffer *, off_t start, size_t count,
                        uint8_t *buf);
diff --git a/migration/migration.c b/migration/migration.c
index b3adbc6..6f1a490 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -540,15 +540,6 @@  void qmp_migrate_set_downtime(double value, Error **errp)
     max_downtime = (uint64_t)value;
 }
 
-bool migrate_rdma_pin_all(void)
-{
-    MigrationState *s;
-
-    s = migrate_get_current();
-
-    return s->enabled_capabilities[MIGRATION_CAPABILITY_RDMA_PIN_ALL];
-}
-
 bool migrate_auto_converge(void)
 {
     MigrationState *s;
diff --git a/migration/qemu-file-buf.c b/migration/qemu-file-buf.c
index e97e0bd..3b79c09 100644
--- a/migration/qemu-file-buf.c
+++ b/migration/qemu-file-buf.c
@@ -124,28 +124,6 @@  size_t qsb_get_length(const QEMUSizedBuffer *qsb)
 }
 
 /**
- * Set the length of the buffer; the primary usage of this
- * function is to truncate the number of used bytes in the buffer.
- * The size will not be extended beyond the current number of
- * allocated bytes in the QEMUSizedBuffer.
- *
- * @qsb: A QEMUSizedBuffer
- * @new_len: The new length of bytes in the buffer
- *
- * Returns the number of bytes the buffer was truncated or extended
- * to.
- */
-size_t qsb_set_length(QEMUSizedBuffer *qsb, size_t new_len)
-{
-    if (new_len <= qsb->size) {
-        qsb->used = new_len;
-    } else {
-        qsb->used = qsb->size;
-    }
-    return qsb->used;
-}
-
-/**
  * Get the iovec that holds the data for a given position @pos.
  *
  * @qsb: A QEMUSizedBuffer
@@ -361,37 +339,6 @@  ssize_t qsb_write_at(QEMUSizedBuffer *qsb, const uint8_t *source,
     return count;
 }
 
-/**
- * Create a deep copy of the given QEMUSizedBuffer.
- *
- * @qsb: A QEMUSizedBuffer
- *
- * Returns a clone of @qsb or NULL on allocation failure
- */
-QEMUSizedBuffer *qsb_clone(const QEMUSizedBuffer *qsb)
-{
-    QEMUSizedBuffer *out = qsb_create(NULL, qsb_get_length(qsb));
-    size_t i;
-    ssize_t res;
-    off_t pos = 0;
-
-    if (!out) {
-        return NULL;
-    }
-
-    for (i = 0; i < qsb->n_iov; i++) {
-        res =  qsb_write_at(out, qsb->iov[i].iov_base,
-                            pos, qsb->iov[i].iov_len);
-        if (res < 0) {
-            qsb_free(out);
-            return NULL;
-        }
-        pos += res;
-    }
-
-    return out;
-}
-
 typedef struct QEMUBuffer {
     QEMUSizedBuffer *qsb;
     QEMUFile *file;