public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Luís Henriques" <lhenriques@suse.de>
To: Jeff Layton <jlayton@kernel.org>
Cc: Ilya Dryomov <idryomov@gmail.com>, Xiubo Li <xiubli@redhat.com>,
	Patrick Donnelly <pdonnell@redhat.com>,
	ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] libceph: have ceph_osdc_copy_from() return the osd request
Date: Wed, 3 Nov 2021 14:32:30 +0000	[thread overview]
Message-ID: <YYKdfvmeqP98Tjno@suse.de> (raw)
In-Reply-To: <597ab2ed71c04327d22e80ef3e630d6f0515c7b7.camel@kernel.org>

On Wed, Nov 03, 2021 at 09:06:31AM -0400, Jeff Layton wrote:
<...>
> > diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> > index ff8624a7c964..78384b431748 100644
> > --- a/net/ceph/osd_client.c
> > +++ b/net/ceph/osd_client.c
> > @@ -5347,23 +5347,24 @@ static int osd_req_op_copy_from_init(struct ceph_osd_request *req,
> >  	return 0;
> >  }
> >  
> > -int ceph_osdc_copy_from(struct ceph_osd_client *osdc,
> > -			u64 src_snapid, u64 src_version,
> > -			struct ceph_object_id *src_oid,
> > -			struct ceph_object_locator *src_oloc,
> > -			u32 src_fadvise_flags,
> > -			struct ceph_object_id *dst_oid,
> > -			struct ceph_object_locator *dst_oloc,
> > -			u32 dst_fadvise_flags,
> > -			u32 truncate_seq, u64 truncate_size,
> > -			u8 copy_from_flags)
> > +struct ceph_osd_request *
> > +ceph_osdc_copy_from(struct ceph_osd_client *osdc,
> > +		    u64 src_snapid, u64 src_version,
> > +		    struct ceph_object_id *src_oid,
> > +		    struct ceph_object_locator *src_oloc,
> > +		    u32 src_fadvise_flags,
> > +		    struct ceph_object_id *dst_oid,
> > +		    struct ceph_object_locator *dst_oloc,
> > +		    u32 dst_fadvise_flags,
> > +		    u32 truncate_seq, u64 truncate_size,
> > +		    u8 copy_from_flags)
> >  {
> >  	struct ceph_osd_request *req;
> >  	int ret;
> >  
> >  	req = ceph_osdc_alloc_request(osdc, NULL, 1, false, GFP_KERNEL);
> >  	if (!req)
> > -		return -ENOMEM;
> > +		return ERR_PTR(-ENOMEM);
> >  
> >  	req->r_flags = CEPH_OSD_FLAG_WRITE;
> >  
> > @@ -5382,11 +5383,11 @@ int ceph_osdc_copy_from(struct ceph_osd_client *osdc,
> >  		goto out;
> >  
> >  	ceph_osdc_start_request(osdc, req, false);
> > -	ret = ceph_osdc_wait_request(osdc, req);
> > +	return req;
> >  
> 
> I don't really understand why this function is part of net/ceph. It's
> odd in that it basically allocates, initializes and starts the request
> and then passes back the pointer to it. That doesn't really follow the
> pattern of the other OSD READ/WRITE ops, where we basically set them up
> and start them more directly from the fs/ceph code.
> 
> I think it'd make more sense to just get rid of ceph_osdc_copy_from
> altogether, export the osd_req_op_copy_from_init symbol and open-code
> the whole thing in ceph_do_objects_copy. This isn't otherwise called
> from rbd or anything else so I don't see the benefit of keeping this
> function as part of libceph.

At the time ceph_osdc_copy_from() was implemented, it looked like
something that would make sense to keep on the osd client code, and
eventually useful for rbd too.  But since that didn't happen, this patch
shows that it makes sense to just move the code.  So, yeah, sure.  I'll do
that.  Thanks.

Cheers,
--
Luís

  reply	other threads:[~2021-11-03 14:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 11:24 [PATCH 0/2] ceph: metrics for remote object copies Luís Henriques
2021-11-03 11:24 ` [PATCH 1/2] libceph: have ceph_osdc_copy_from() return the osd request Luís Henriques
2021-11-03 13:06   ` Jeff Layton
2021-11-03 14:32     ` Luís Henriques [this message]
2021-11-03 11:24 ` [PATCH 2/2] ceph: add a new metric to keep track of remote object copies Luís Henriques

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=YYKdfvmeqP98Tjno@suse.de \
    --to=lhenriques@suse.de \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pdonnell@redhat.com \
    --cc=xiubli@redhat.com \
    /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