All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Dryomov <idryomov@gmail.com>
To: Jeff Layton <jlayton@kernel.org>
Cc: Ceph Development <ceph-devel@vger.kernel.org>
Subject: Re: [PATCH 3/4] libceph: rename __ceph_osdc_alloc_messages to ceph_osdc_alloc_num_messages
Date: Wed, 1 Jul 2020 21:40:12 +0200	[thread overview]
Message-ID: <CAOi1vP9prxnVNbTDvJM8os6K_o7EcqSif4Ey4Moba-j7FJdOtg@mail.gmail.com> (raw)
In-Reply-To: <1d5a9f273770150266e3e45e11116a82484e4a14.camel@kernel.org>

On Wed, Jul 1, 2020 at 9:17 PM Jeff Layton <jlayton@kernel.org> wrote:
>
> On Wed, 2020-07-01 at 20:48 +0200, Ilya Dryomov wrote:
> > On Wed, Jul 1, 2020 at 5:54 PM Jeff Layton <jlayton@kernel.org> wrote:
> > > ...and make it public and export it.
> > >
> > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > > ---
> > >  include/linux/ceph/osd_client.h |  3 +++
> > >  net/ceph/osd_client.c           | 13 +++++++------
> > >  2 files changed, 10 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h
> > > index 40a08c4e5d8d..71b7610c3a3c 100644
> > > --- a/include/linux/ceph/osd_client.h
> > > +++ b/include/linux/ceph/osd_client.h
> > > @@ -481,6 +481,9 @@ extern struct ceph_osd_request *ceph_osdc_alloc_request(struct ceph_osd_client *
> > >                                                unsigned int num_ops,
> > >                                                bool use_mempool,
> > >                                                gfp_t gfp_flags);
> > > +int ceph_osdc_alloc_num_messages(struct ceph_osd_request *req, gfp_t gfp,
> > > +                                int num_request_data_items,
> > > +                                int num_reply_data_items);
> > >  int ceph_osdc_alloc_messages(struct ceph_osd_request *req, gfp_t gfp);
> > >
> > >  extern struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *,
> > > diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> > > index 4ddf23120b1a..7be78fa6e2c3 100644
> > > --- a/net/ceph/osd_client.c
> > > +++ b/net/ceph/osd_client.c
> > > @@ -613,9 +613,9 @@ static int ceph_oloc_encoding_size(const struct ceph_object_locator *oloc)
> > >         return 8 + 4 + 4 + 4 + (oloc->pool_ns ? oloc->pool_ns->len : 0);
> > >  }
> > >
> > > -static int __ceph_osdc_alloc_messages(struct ceph_osd_request *req, gfp_t gfp,
> > > -                                     int num_request_data_items,
> > > -                                     int num_reply_data_items)
> > > +int ceph_osdc_alloc_num_messages(struct ceph_osd_request *req, gfp_t gfp,
> > > +                                int num_request_data_items,
> > > +                                int num_reply_data_items)
> > >  {
> > >         struct ceph_osd_client *osdc = req->r_osdc;
> > >         struct ceph_msg *msg;
> > > @@ -672,6 +672,7 @@ static int __ceph_osdc_alloc_messages(struct ceph_osd_request *req, gfp_t gfp,
> > >
> > >         return 0;
> > >  }
> > > +EXPORT_SYMBOL(ceph_osdc_alloc_num_messages);
> > >
> > >  static bool osd_req_opcode_valid(u16 opcode)
> > >  {
> > > @@ -738,8 +739,8 @@ int ceph_osdc_alloc_messages(struct ceph_osd_request *req, gfp_t gfp)
> > >         int num_request_data_items, num_reply_data_items;
> > >
> > >         get_num_data_items(req, &num_request_data_items, &num_reply_data_items);
> > > -       return __ceph_osdc_alloc_messages(req, gfp, num_request_data_items,
> > > -                                         num_reply_data_items);
> > > +       return ceph_osdc_alloc_num_messages(req, gfp, num_request_data_items,
> > > +                                                 num_reply_data_items);
> > >  }
> > >  EXPORT_SYMBOL(ceph_osdc_alloc_messages);
> > >
> > > @@ -1129,7 +1130,7 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
> > >                  * also covers ceph_uninline_data().  If more multi-op request
> > >                  * use cases emerge, we will need a separate helper.
> > >                  */
> > > -               r = __ceph_osdc_alloc_messages(req, GFP_NOFS, num_ops, 0);
> > > +               r = ceph_osdc_alloc_num_messages(req, GFP_NOFS, num_ops, 0);
> > >         else
> > >                 r = ceph_osdc_alloc_messages(req, GFP_NOFS);
> > >         if (r)
> >
> > I think exporting __ceph_osdc_alloc_messages() is wrong, at least
> > conceptually.  Only the OSD client should be concerned with message
> > data items and their count, as they are an implementation detail of
> > the OSD client and the messenger.  Exporting something that takes
> > message data items counts without exporting something for counting
> > them suggests that users will somehow do that on their own and we
> > don't want that.
> >
>
> We already do that in ceph_osdc_new_request(). That function takes a
> num_ops value that describes the number of OSD ops needed, and the
> callers have to fill it out with the number of ops they expect the call
> to use (see the calls in ceph_writepages_start for example).

The number of message data items is not necessarily the same as
the number of OSD ops.  Further, the number of message data items
is different for request and reply messages of the OSD request.
__ceph_osdc_alloc_messages() is private precisely to avoid this
confusion.

Thanks,

                Ilya

  reply	other threads:[~2020-07-01 19:40 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-01 15:54 [PATCH 0/4] libceph/ceph: cleanups and move more into ceph.ko Jeff Layton
2020-07-01 15:54 ` [PATCH 1/4] libceph: just have osd_req_op_init return a pointer Jeff Layton
2020-07-06 16:41   ` Jeff Layton
2020-07-08 10:18     ` Ilya Dryomov
2020-07-01 15:54 ` [PATCH 2/4] libceph: refactor osdc request initialization Jeff Layton
2020-07-01 18:08   ` Ilya Dryomov
2020-07-01 18:24     ` Jeff Layton
2020-07-01 19:25       ` Ilya Dryomov
2020-07-01 15:54 ` [PATCH 3/4] libceph: rename __ceph_osdc_alloc_messages to ceph_osdc_alloc_num_messages Jeff Layton
2020-07-01 18:48   ` Ilya Dryomov
2020-07-01 19:17     ` Jeff Layton
2020-07-01 19:40       ` Ilya Dryomov [this message]
2020-07-01 19:51         ` Jeff Layton
2020-07-01 15:54 ` [PATCH 4/4] libceph/ceph: move ceph_osdc_new_request into ceph.ko Jeff Layton
2020-07-01 19:15   ` Ilya Dryomov
2020-07-01 19:22     ` Jeff Layton
2020-07-01 20:04       ` Ilya Dryomov

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=CAOi1vP9prxnVNbTDvJM8os6K_o7EcqSif4Ey4Moba-j7FJdOtg@mail.gmail.com \
    --to=idryomov@gmail.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=jlayton@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.