Re: [PATCH 11/12] libceph: make ceph_con_get() (etc.) private

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

 



These should actually go away entirely; pushed a couple patches that do 
that, and remove the now-unused con->nref member.

sage

On Thu, 21 Jun 2012, Alex Elder wrote:

> The functions ceph_con_get() and ceph_con_put() are both only ever
> used in "net/ceph/messenger.c", so change them to have static scope.
> Move their definition up in the source file so they're both defined
> before their first use.
> 
> Signed-off-by: Alex Elder <elder@xxxxxxxxxxx>
> ---
>  include/linux/ceph/messenger.h |    2 -
>  net/ceph/messenger.c           |   48
> ++++++++++++++++++++---------------------
>  2 files changed, 24 insertions(+), 26 deletions(-)
> 
> Index: b/include/linux/ceph/messenger.h
> ===================================================================
> --- a/include/linux/ceph/messenger.h
> +++ b/include/linux/ceph/messenger.h
> @@ -245,8 +245,6 @@ extern void ceph_msg_revoke(struct ceph_
>  extern void ceph_msg_revoke_incoming(struct ceph_msg *msg);
> 
>  extern void ceph_con_keepalive(struct ceph_connection *con);
> -extern struct ceph_connection *ceph_con_get(struct ceph_connection *con);
> -extern void ceph_con_put(struct ceph_connection *con);
> 
>  extern struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
>  				     bool can_fail);
> Index: b/net/ceph/messenger.c
> ===================================================================
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -408,6 +408,30 @@ static int con_close_socket(struct ceph_
>  }
> 
>  /*
> + * generic get/put
> + */
> +static struct ceph_connection *ceph_con_get(struct ceph_connection *con)
> +{
> +	int nref = __atomic_add_unless(&con->nref, 1, 0);
> +
> +	dout("con_get %p nref = %d -> %d\n", con, nref, nref + 1);
> +
> +	return nref ? con : NULL;
> +}
> +
> +static void ceph_con_put(struct ceph_connection *con)
> +{
> +	int nref = atomic_dec_return(&con->nref);
> +
> +	BUG_ON(nref < 0);
> +	if (nref == 0) {
> +		BUG_ON(con->sock);
> +		kfree(con);
> +	}
> +	dout("con_put %p nref = %d -> %d\n", con, nref + 1, nref);
> +}
> +
> +/*
>   * Reset a connection.  Discard all incoming and outgoing messages
>   * and clear *_seq state.
>   */
> @@ -504,30 +528,6 @@ bool ceph_con_opened(struct ceph_connect
>  }
> 
>  /*
> - * generic get/put
> - */
> -struct ceph_connection *ceph_con_get(struct ceph_connection *con)
> -{
> -	int nref = __atomic_add_unless(&con->nref, 1, 0);
> -
> -	dout("con_get %p nref = %d -> %d\n", con, nref, nref + 1);
> -
> -	return nref ? con : NULL;
> -}
> -
> -void ceph_con_put(struct ceph_connection *con)
> -{
> -	int nref = atomic_dec_return(&con->nref);
> -
> -	BUG_ON(nref < 0);
> -	if (nref == 0) {
> -		BUG_ON(con->sock);
> -		kfree(con);
> -	}
> -	dout("con_put %p nref = %d -> %d\n", con, nref + 1, nref);
> -}
> -
> -/*
>   * initialize a new connection.
>   */
>  void ceph_con_init(struct ceph_connection *con, void *private,
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux