linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Javier González" <javier@javigon.com>
To: Hans Holmberg <hans.ml.holmberg@owltronix.com>
Cc: "Matias Bjørling" <mb@lightnvm.io>,
	linux-block@vger.kernel.org,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] lightnvm: pblk: take write semaphore on metadata
Date: Mon, 13 Aug 2018 14:12:04 +0200	[thread overview]
Message-ID: <61F640FB-E38C-41CE-B95A-D2CDAA0008EF@javigon.com> (raw)
In-Reply-To: <CANr-nt18UvLY7YjUqTDtd-mi+Az-WTMvcbCTC1uVgBpddS=zxQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1981 bytes --]

> On 10 Aug 2018, at 10.04, Hans Holmberg <hans.ml.holmberg@owltronix.com> wrote:
> 
> On Fri, Aug 3, 2018 at 2:05 PM, Javier González <javier@javigon.com> wrote:
>> pblk guarantees write ordering at a chunk level through a per open chunk
>> semaphore. At this point, since we only have an open I/O stream for both
>> user and GC data, the semaphore is per parallel unit.
>> 
>> Since metadata I/O is synchronous, the semaphore is not needed as
>> ordering is guaranteed. However, if the metadata scheme changes or
>> multiple streams are open, this guarantee might not be preserved.
>> 
>> This patch makes sure that all writes go through the semaphore, even for
>> synchronous I/O. This is consistent with pblk's write I/O model. It also
>> simplifies maintenance since changes in the metdatada scheme could cause
>> ordering issues.
>> 
>> Signed-off-by: Javier González <javier@cnexlabs.com>
>> ---
>> drivers/lightnvm/pblk-core.c | 14 ++++++++++++--
>> drivers/lightnvm/pblk.h      |  1 +
>> 2 files changed, 13 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
>> index 00984b486fea..160b54d26bfa 100644
>> --- a/drivers/lightnvm/pblk-core.c
>> +++ b/drivers/lightnvm/pblk-core.c
>> @@ -493,6 +493,16 @@ int pblk_submit_io_sync(struct pblk *pblk, struct nvm_rq *rqd)
>>        return nvm_submit_io_sync(dev, rqd);
>> }
>> 
>> +int pblk_submit_io_sync_sem(struct pblk *pblk, struct nvm_rq *rqd)
>> +{
>> +       if (rqd->opcode != NVM_OP_PWRITE)
>> +               pblk_submit_io_sync(pblk, rqd);
>> +
>> +       pblk_down_page(pblk, rqd->ppa_list, rqd->nr_ppas);
> 
> This will only work if rqd->nr_ppas > 1, better check if rqd->nr_ppas
> is 1 and pass &ppa->ppa_addr on to pblk_down_page when needed.


For this particular case, we will always get > 1 ppas, but you're right,
it is more robust to do the check for future cases. I'll add that to V3.
Thanks!

Javier

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2018-08-13 12:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-03 12:05 [PATCH] lightnvm: pblk: take write semaphore on metadata Javier González
2018-08-03 12:45 ` Matias Bjørling
2018-08-03 13:28   ` Javier Gonzalez
2018-08-10  8:04 ` Hans Holmberg
2018-08-13 12:12   ` Javier González [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-08-02 13:47 Javier González
2018-08-02 15:57 ` Jens Axboe
2018-08-02 16:01   ` Javier Gonzalez

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=61F640FB-E38C-41CE-B95A-D2CDAA0008EF@javigon.com \
    --to=javier@javigon.com \
    --cc=hans.ml.holmberg@owltronix.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mb@lightnvm.io \
    /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).