Skip to content

data placement hints and FDP

Kanchan Joshi linux-block linux-f2fs-devel linux-fsdevel linux-nvme linux-scsi 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest5 patches 24 repliesIn review 1 of 5 applied
  2. v45 patches 10 repliesSuperseded

Changes in v5 from the cover letter

- Retain the size/type checking on the enum (Bart)
- Use the name "*_lifetime_hint" rather than "*_life_hint" (Bart)

Patches in v5 1 of 5 applied

#Subject and filesSizeRepliesApplied
1/5fs, block: refactor enum rw_hintfs/buffer.c fs/f2fs/f2fs.h fs/f2fs/segment.c +4 more+13 -114 replies
2/5fcntl: rename rw_hint_* to rw_lifetime_hint_*fs/fcntl.c+6 -62 replies
3/5fcntl: add F_{SET/GET}_RW_HINT_EXfs/fcntl.c include/linux/rw_hint.h include/uapi/linux/fcntl.h+94 -06 replies
4/5sd: limit to use write life hintsdrivers/scsi/sd.c+4 -312 replies
5/5nvme: enable FDP supportdrivers/nvme/host/core.c drivers/nvme/host/nvme.h include/linux/nvme.h+104 -00 repliesApplied

Reviews trailers per patch

1 of 5 patches has a Reviewed-by or Acked-by.

PatchKeith Busch
1/5
2/5
3/5
4/5
5/5A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/5] data placement hints and FDP

Current write-hint infrastructure supports 6 temperature-based data lifetime hints.
The series extends the infrastructure with a new temperature-agnostic placement-type hint. New fcntl codes F_{SET/GET}_RW_HINT_EX allow to send the hint type/value on file. See patch #3 commit description and interface example below [*].

Overall this creates 127 placement hint values that users can pass.

Patch #5 adds the ability to map these new hint values to nvme-specific placement-identifiers.
Patch #4 restricts SCSI to use only lifetime hint values. Patch #1 and #2 are simple prep patches.

[*]
#define _GNU_SOURCE

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/fcntl.h>

int main(int argc, char *argv[])

{
        struct rw_hint_ex set_hint_ex={}, get_hint_ex={};
        int fd, ret;

        if (argc < 4) {
                fprintf(stderr, "Usage: %s file <hint type> <hint value>\n",
                        argv[0]);
                return 1;
        }

        fd = open(argv[1], O_CREAT|O_RDWR|O_DIRECT, 0644);
        if (fd < 0) {
                perror("open");
                return 1;
        }

        set_hint_ex.type = atoi(argv[2]);
        set_hint_ex.val = atol(argv[3]);

        ret = fcntl(fd, F_SET_RW_HINT_EX, &set_hint_ex);
        if (ret < 0) {
                perror("fcntl: Error, F_SET_RW_HINT_EX");
                goto close_fd;
        }
        ret = fcntl(fd, F_GET_RW_HINT_EX, &get_hint_ex);
        if (ret < 0) {
                perror("fcntl: Error, F_GET_RW_HINT_EX");
                goto close_fd;
        }
        printf("set_hint (%d,%llu)\nget_hint (%d,%llu)\n",
               set_hint_ex.type, set_hint_ex.val,
               get_hint_ex.type, get_hint_ex.val);

close_fd:

        close(fd);
        return 0;
}

/* set placement hint (type 2) with value 126 */

# ./a.out /dev/nvme0n1 2 126
set_hint (2,126)
get_hint (2,126)

/* invalid placement hint value */

# ./a.out /dev/nvme0n1 2 128
fcntl: Error, F_SET_RW_HINT_EX: Invalid argument

Changes since v4:
- Retain the size/type checking on the enum (Bart)
- Use the name "*_lifetime_hint" rather than "*_life_hint" (Bart)

Changes since v3:
- 4 new patches to introduce placement hints
- Make nvme patch use the placement hints rather than lifetime hints

Changes since v2:
- Base it on nvme-6.11 and resolve a merge conflict

Changes since v1:
- Reduce the fetched plids from 128 to 6 (Keith)
- Use struct_size for a calculation (Keith)
- Handle robot/sparse warning

Kanchan Joshi (4):
fs, block: refactor enum rw_hint
fcntl: rename rw_hint_* to rw_lifetime_hint_*
fcntl: add F_{SET/GET}_RW_HINT_EX
nvme: enable FDP support

Nitesh Shetty (1):
sd: limit to use write life hints

 drivers/nvme/host/core.c   | 81 ++++++++++++++++++++++++++++++++++++++
 drivers/nvme/host/nvme.h   |  4 ++
 drivers/scsi/sd.c          |  7 ++--
 fs/buffer.c                |  4 +-
 fs/f2fs/f2fs.h             |  5 ++-
 fs/f2fs/segment.c          |  5 ++-
 fs/fcntl.c                 | 79 ++++++++++++++++++++++++++++++++++---
 include/linux/blk-mq.h     |  2 +-
 include/linux/blk_types.h  |  2 +-
 include/linux/fs.h         |  2 +-
 include/linux/nvme.h       | 19 +++++++++
 include/linux/rw_hint.h    | 17 +++++++-
 include/uapi/linux/fcntl.h | 14 +++++++
 13 files changed, 221 insertions(+), 20 deletions(-)
Signature · 1 line
2.25.1