qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: dave@treblig.org, kwolf@redhat.com, hreitz@redhat.com,
	QEMU Trivial <qemu-trivial@nongnu.org>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH] block-backend: Remove deadcode
Date: Wed, 2 Oct 2024 12:45:05 +0200	[thread overview]
Message-ID: <17c2adb4-9346-46dc-a93b-b0bfa3207cfe@redhat.com> (raw)
In-Reply-To: <20240917002056.330818-1-dave@treblig.org>

On 17/09/2024 02.20, dave@treblig.org wrote:
> From: "Dr. David Alan Gilbert" <dave@treblig.org>
> 
> blk_by_public last use was removed in 2017 by
>    c61791fc23 ("block: add aio_context field in ThrottleGroupMember")
> 
> blk_activate last use was removed earlier this year by
>    eef0bae3a7 ("migration: Remove block migration")
> 
> blk_add_insert_bs_notifier, blk_op_block_all, blk_op_unblock_all
> last uses were removed in 2016 by
>    ef8875b549 ("virtio-scsi: Remove op blocker for dataplane")
> 
> blk_iostatus_disable last use was removed in 2016 by
>    66a0fae438 ("blockjob: Don't touch BDS iostatus")
> 
> Remove them.
> 
> Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
> ---
>   block/block-backend.c                       | 73 ---------------------
>   include/sysemu/block-backend-global-state.h |  8 ---
>   2 files changed, 81 deletions(-)
> 
> diff --git a/block/block-backend.c b/block/block-backend.c
> index db6f9b92a3..7bea43bf72 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -853,15 +853,6 @@ BlockBackendPublic *blk_get_public(BlockBackend *blk)
>       return &blk->public;
>   }
>   
> -/*
> - * Returns a BlockBackend given the associated @public fields.
> - */
> -BlockBackend *blk_by_public(BlockBackendPublic *public)
> -{
> -    GLOBAL_STATE_CODE();
> -    return container_of(public, BlockBackend, public);
> -}
> -
>   /*
>    * Disassociates the currently associated BlockDriverState from @blk.
>    */
> @@ -1214,12 +1205,6 @@ BlockDeviceIoStatus blk_iostatus(const BlockBackend *blk)
>       return blk->iostatus;
>   }
>   
> -void blk_iostatus_disable(BlockBackend *blk)
> -{
> -    GLOBAL_STATE_CODE();
> -    blk->iostatus_enabled = false;
> -}
> -
>   void blk_iostatus_reset(BlockBackend *blk)
>   {
>       GLOBAL_STATE_CODE();
> @@ -2228,28 +2213,6 @@ void blk_set_enable_write_cache(BlockBackend *blk, bool wce)
>       blk->enable_write_cache = wce;
>   }
>   
> -void blk_activate(BlockBackend *blk, Error **errp)
> -{
> -    BlockDriverState *bs = blk_bs(blk);
> -    GLOBAL_STATE_CODE();
> -
> -    if (!bs) {
> -        error_setg(errp, "Device '%s' has no medium", blk->name);
> -        return;
> -    }
> -
> -    /*
> -     * Migration code can call this function in coroutine context, so leave
> -     * coroutine context if necessary.
> -     */
> -    if (qemu_in_coroutine()) {
> -        bdrv_co_activate(bs, errp);
> -    } else {
> -        GRAPH_RDLOCK_GUARD_MAINLOOP();
> -        bdrv_activate(bs, errp);
> -    }
> -}
> -
>   bool coroutine_fn blk_co_is_inserted(BlockBackend *blk)
>   {
>       BlockDriverState *bs = blk_bs(blk);
> @@ -2380,36 +2343,6 @@ bool blk_op_is_blocked(BlockBackend *blk, BlockOpType op, Error **errp)
>       return bdrv_op_is_blocked(bs, op, errp);
>   }
>   
> -void blk_op_unblock(BlockBackend *blk, BlockOpType op, Error *reason)
> -{
> -    BlockDriverState *bs = blk_bs(blk);
> -    GLOBAL_STATE_CODE();
> -
> -    if (bs) {
> -        bdrv_op_unblock(bs, op, reason);
> -    }
> -}
> -
> -void blk_op_block_all(BlockBackend *blk, Error *reason)
> -{
> -    BlockDriverState *bs = blk_bs(blk);
> -    GLOBAL_STATE_CODE();
> -
> -    if (bs) {
> -        bdrv_op_block_all(bs, reason);
> -    }
> -}
> -
> -void blk_op_unblock_all(BlockBackend *blk, Error *reason)
> -{
> -    BlockDriverState *bs = blk_bs(blk);
> -    GLOBAL_STATE_CODE();
> -
> -    if (bs) {
> -        bdrv_op_unblock_all(bs, reason);
> -    }
> -}
> -
>   /**
>    * Return BB's current AioContext.  Note that this context may change
>    * concurrently at any time, with one exception: If the BB has a root node
> @@ -2564,12 +2497,6 @@ void blk_add_remove_bs_notifier(BlockBackend *blk, Notifier *notify)
>       notifier_list_add(&blk->remove_bs_notifiers, notify);
>   }
>   
> -void blk_add_insert_bs_notifier(BlockBackend *blk, Notifier *notify)
> -{
> -    GLOBAL_STATE_CODE();
> -    notifier_list_add(&blk->insert_bs_notifiers, notify);
> -}
> -
>   BlockAcctStats *blk_get_stats(BlockBackend *blk)
>   {
>       IO_CODE();
> diff --git a/include/sysemu/block-backend-global-state.h b/include/sysemu/block-backend-global-state.h
> index 49c12b0fa9..9cc9b008ec 100644
> --- a/include/sysemu/block-backend-global-state.h
> +++ b/include/sysemu/block-backend-global-state.h
> @@ -54,7 +54,6 @@ bool monitor_add_blk(BlockBackend *blk, const char *name, Error **errp);
>   void monitor_remove_blk(BlockBackend *blk);
>   
>   BlockBackendPublic *blk_get_public(BlockBackend *blk);
> -BlockBackend *blk_by_public(BlockBackendPublic *public);
>   
>   void blk_remove_bs(BlockBackend *blk);
>   int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp);
> @@ -67,7 +66,6 @@ void blk_get_perm(BlockBackend *blk, uint64_t *perm, uint64_t *shared_perm);
>   
>   void blk_iostatus_enable(BlockBackend *blk);
>   BlockDeviceIoStatus blk_iostatus(const BlockBackend *blk);
> -void blk_iostatus_disable(BlockBackend *blk);
>   void blk_iostatus_reset(BlockBackend *blk);
>   int blk_attach_dev(BlockBackend *blk, DeviceState *dev);
>   void blk_detach_dev(BlockBackend *blk, DeviceState *dev);
> @@ -76,8 +74,6 @@ BlockBackend *blk_by_dev(void *dev);
>   BlockBackend *blk_by_qdev_id(const char *id, Error **errp);
>   void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, void *opaque);
>   
> -void blk_activate(BlockBackend *blk, Error **errp);
> -
>   int blk_make_zero(BlockBackend *blk, BdrvRequestFlags flags);
>   void blk_aio_cancel(BlockAIOCB *acb);
>   int blk_commit_all(void);
> @@ -91,9 +87,6 @@ bool blk_is_sg(BlockBackend *blk);
>   void blk_set_enable_write_cache(BlockBackend *blk, bool wce);
>   int blk_get_flags(BlockBackend *blk);
>   bool blk_op_is_blocked(BlockBackend *blk, BlockOpType op, Error **errp);
> -void blk_op_unblock(BlockBackend *blk, BlockOpType op, Error *reason);
> -void blk_op_block_all(BlockBackend *blk, Error *reason);
> -void blk_op_unblock_all(BlockBackend *blk, Error *reason);
>   int blk_set_aio_context(BlockBackend *blk, AioContext *new_context,
>                           Error **errp);
>   void blk_add_aio_context_notifier(BlockBackend *blk,
> @@ -105,7 +98,6 @@ void blk_remove_aio_context_notifier(BlockBackend *blk,
>                                        void (*detach_aio_context)(void *),
>                                        void *opaque);
>   void blk_add_remove_bs_notifier(BlockBackend *blk, Notifier *notify);
> -void blk_add_insert_bs_notifier(BlockBackend *blk, Notifier *notify);
>   BlockBackendRootState *blk_get_root_state(BlockBackend *blk);
>   void blk_update_root_state(BlockBackend *blk);
>   bool blk_get_detect_zeroes_from_root_state(BlockBackend *blk);

Reviewed-by: Thomas Huth <thuth@redhat.com>



      reply	other threads:[~2024-10-02 10:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-17  0:20 [PATCH] block-backend: Remove deadcode dave
2024-10-02 10:45 ` Thomas Huth [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17c2adb4-9346-46dc-a93b-b0bfa3207cfe@redhat.com \
    --to=thuth@redhat.com \
    --cc=dave@treblig.org \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).