linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kanchan Joshi <joshi.k@samsung.com>
To: axboe@kernel.dk, kbusch@kernel.org, hch@lst.de, sagi@grimberg.me,
	martin.petersen@oracle.com,
	James.Bottomley@HansenPartnership.com, brauner@kernel.org,
	viro@zeniv.linux.org.uk, jack@suse.cz, jaegeuk@kernel.org,
	jlayton@kernel.org, chuck.lever@oracle.com, bvanassche@acm.org
Cc: linux-nvme@lists.infradead.org, linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-block@vger.kernel.org, linux-scsi@vger.kernel.org,
	gost.dev@samsung.com, vishak.g@samsung.com,
	javier.gonz@samsung.com, Kanchan Joshi <joshi.k@samsung.com>
Subject: [PATCH v5 0/5] data placement hints and FDP
Date: Tue, 10 Sep 2024 20:31:55 +0530	[thread overview]
Message-ID: <20240910150200.6589-1-joshi.k@samsung.com> (raw)
In-Reply-To: CGME20240910151040epcas5p3f47fa7ea37a35f8b44dd9174689e1bb9@epcas5p3.samsung.com

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(-)

-- 
2.25.1


       reply	other threads:[~2024-09-10 15:10 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20240910151040epcas5p3f47fa7ea37a35f8b44dd9174689e1bb9@epcas5p3.samsung.com>
2024-09-10 15:01 ` Kanchan Joshi [this message]
     [not found]   ` <CGME20240910151044epcas5p37f61bb85ccf8b3eb875e77c3fc260c51@epcas5p3.samsung.com>
2024-09-10 15:01     ` [PATCH v5 1/5] fs, block: refactor enum rw_hint Kanchan Joshi
2024-09-12 12:53       ` Christoph Hellwig
2024-09-12 15:50         ` Kanchan Joshi
2024-09-12 20:30           ` Bart Van Assche
2024-09-13  7:22             ` Kanchan Joshi
     [not found]   ` <CGME20240910151048epcas5p3c610d63022362ec5fcc6fc362ad2fb9f@epcas5p3.samsung.com>
2024-09-10 15:01     ` [PATCH v5 2/5] fcntl: rename rw_hint_* to rw_lifetime_hint_* Kanchan Joshi
2024-09-12 12:54       ` Christoph Hellwig
2024-09-12 15:51         ` Kanchan Joshi
     [not found]   ` <CGME20240910151052epcas5p48b20962753b1e3171daf98f050d0b5af@epcas5p4.samsung.com>
2024-09-10 15:01     ` [PATCH v5 3/5] fcntl: add F_{SET/GET}_RW_HINT_EX Kanchan Joshi
2024-09-10 18:48       ` Jens Axboe
2024-09-11 15:50         ` Kanchan Joshi
2024-09-12 13:01       ` Christoph Hellwig
2024-09-12 15:53         ` Kanchan Joshi
2024-09-12 20:36       ` Bart Van Assche
2024-09-13  7:15         ` Kanchan Joshi
     [not found]   ` <CGME20240910151057epcas5p3369c6257a6f169b4caa6dd59548b538c@epcas5p3.samsung.com>
2024-09-10 15:01     ` [PATCH v5 4/5] sd: limit to use write life hints Kanchan Joshi
2024-09-12 13:02       ` Christoph Hellwig
2024-09-12 16:31         ` Kanchan Joshi
2024-09-13  8:06           ` Christoph Hellwig
2024-09-16 13:49             ` Kanchan Joshi
2024-09-17  6:20               ` Christoph Hellwig
2024-09-17 16:03                 ` Kanchan Joshi
2024-09-17 17:00                   ` Kanchan Joshi
2024-09-18  6:42                   ` Christoph Hellwig
2024-09-18  8:12                     ` Kanchan Joshi
2024-09-18 12:01                       ` Christoph Hellwig
2024-09-24  9:24                         ` Kanchan Joshi
2024-09-24  9:28                           ` Christoph Hellwig
     [not found]   ` <CGME20240910151101epcas5p1c4e90f7334125fc49106d58d43cffcec@epcas5p1.samsung.com>
2024-09-10 15:02     ` [PATCH v5 5/5] nvme: enable FDP support Kanchan Joshi
2025-01-29  0:56   ` [f2fs-dev] [PATCH v5 0/5] data placement hints and FDP patchwork-bot+f2fs

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=20240910150200.6589-1-joshi.k@samsung.com \
    --to=joshi.k@samsung.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=axboe@kernel.dk \
    --cc=brauner@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=chuck.lever@oracle.com \
    --cc=gost.dev@samsung.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=jaegeuk@kernel.org \
    --cc=javier.gonz@samsung.com \
    --cc=jlayton@kernel.org \
    --cc=kbusch@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sagi@grimberg.me \
    --cc=viro@zeniv.linux.org.uk \
    --cc=vishak.g@samsung.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;
as well as URLs for NNTP newsgroup(s).