All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dongsheng Yang <dongsheng.yang@linux.dev>
To: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: mpatocka@redhat.com, agk@redhat.com, snitzer@kernel.org,
	axboe@kernel.dk, hch@lst.de, dan.j.williams@intel.com,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev,
	dm-devel@lists.linux.dev
Subject: Re: [PATCH v1 04/11] dm-pcache: add segment layer
Date: Mon, 7 Jul 2025 14:24:42 +0800	[thread overview]
Message-ID: <6134aafc-d91d-46d8-ac6d-ef10ef459929@linux.dev> (raw)
In-Reply-To: <20250701154659.000067f9@huawei.com>


在 7/1/2025 10:46 PM, Jonathan Cameron 写道:
> On Tue, 24 Jun 2025 07:33:51 +0000
> Dongsheng Yang <dongsheng.yang@linux.dev> wrote:
>
>> Introduce segment.{c,h}, an internal abstraction that encapsulates
>> everything related to a single pcache *segment* (the fixed-size
>> allocation unit stored on the cache-device).
>>
>> * On-disk metadata (`struct pcache_segment_info`)
>>    - Embedded `struct pcache_meta_header` for CRC/sequence handling.
>>    - `flags` field encodes a “has-next” bit and a 4-bit *type* class
>>      (`CACHE_DATA` added as the first type).
>>
>> * Initialisation
>>    - `pcache_segment_init()` populates the in-memory
>>      `struct pcache_segment` from a given segment id, data offset and
>>      metadata pointer, computing the usable `data_size` and virtual
>>      address within the DAX mapping.
>>
>> * IO helpers
>>    - `segment_copy_to_bio()` / `segment_copy_from_bio()` move data
>>      between pmem and a bio, using `_copy_mc_to_iter()` and
>>      `_copy_from_iter_flushcache()` to tolerate hw memory errors and
>>      ensure durability.
>>    - `segment_pos_advance()` advances an internal offset while staying
>>      inside the segment’s data area.
>>
>> These helpers allow upper layers (cache key management, write-back
>> logic, GC, etc.) to treat a segment as a contiguous byte array without
>> knowing about DAX mappings or persistence details.
>>
>> Signed-off-by: Dongsheng Yang <dongsheng.yang@linux.dev>
> Hi
>
> Just one trivial comment.
>
>> diff --git a/drivers/md/dm-pcache/segment.h b/drivers/md/dm-pcache/segment.h
>> new file mode 100644
>> index 000000000000..9675951ffaf8
>> --- /dev/null
>> +++ b/drivers/md/dm-pcache/segment.h
>> @@ -0,0 +1,73 @@
>> +/* SPDX-License-Identifier: GPL-2.0-or-later */
>> +#ifndef _PCACHE_SEGMENT_H
>> +#define _PCACHE_SEGMENT_H
>> +
>> +#include <linux/bio.h>
>> +
>> +#include "pcache_internal.h"
>> +
>> +struct pcache_segment_info {
>> +	struct pcache_meta_header	header;	/* Metadata header for the segment */
> The comment is fairly obvious given the type of the field. I'd drop the comment.

Hi Jonathan,

Sounds not bad, will change it.

Thanx

>
>> +	__u32			flags;
>> +	__u32			next_seg;
>> +};
>

  reply	other threads:[~2025-07-07  6:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24  7:33 [PATCH v1 00/11] dm-pcache – persistent-memory cache for block devices Dongsheng Yang
2025-06-24  7:33 ` [PATCH v1 01/11] dm-pcache: add pcache_internal.h Dongsheng Yang
2025-07-01 13:43   ` Jonathan Cameron
2025-06-24  7:33 ` [PATCH v1 02/11] dm-pcache: add backing device management Dongsheng Yang
2025-07-01 13:56   ` Jonathan Cameron
2025-07-07  6:25     ` Dongsheng Yang
2025-06-24  7:33 ` [PATCH v1 03/11] dm-pcache: add cache device Dongsheng Yang
2025-07-01 14:07   ` Jonathan Cameron
2025-06-24  7:33 ` [PATCH v1 04/11] dm-pcache: add segment layer Dongsheng Yang
2025-07-01 14:46   ` Jonathan Cameron
2025-07-07  6:24     ` Dongsheng Yang [this message]
2025-06-24  7:33 ` [PATCH v1 05/11] dm-pcache: add cache_segment Dongsheng Yang
2025-07-01 14:59   ` Jonathan Cameron
2025-07-07  6:24     ` Dongsheng Yang
2025-06-24  7:33 ` [PATCH v1 06/11] dm-pcache: add cache_writeback Dongsheng Yang
2025-06-24  7:33 ` [PATCH v1 07/11] dm-pcache: add cache_gc Dongsheng Yang
2025-06-24  7:33 ` [PATCH v1 08/11] dm-pcache: add cache_key Dongsheng Yang
2025-06-24  7:33 ` [PATCH v1 09/11] dm-pcache: add cache_req Dongsheng Yang
2025-06-24  7:33 ` [PATCH v1 10/11] dm-pcache: add cache core Dongsheng Yang
2025-06-24  7:33 ` [PATCH v1 11/11] dm-pcache: initial dm-pcache target Dongsheng Yang
2025-06-30 13:30 ` [PATCH v1 00/11] dm-pcache – persistent-memory cache for block devices Mikulas Patocka
2025-06-30 13:40   ` Dongsheng Yang
2025-06-30 14:16     ` Dongsheng Yang
2025-06-30 15:45       ` Mikulas Patocka
2025-06-30 16:30         ` Dongsheng Yang

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=6134aafc-d91d-46d8-ac6d-ef10ef459929@linux.dev \
    --to=dongsheng.yang@linux.dev \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=agk@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=dan.j.williams@intel.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=snitzer@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.