Re: [PATCH 1/9] fs: add fcntl() interface for setting/getting write life time hints

Started by Christoph Hellwig on Jun 26, 2017 · 4 messages from 3 authors · Last reply Jun 26, 2017

open the first message on its own page

Message details and related content
Please document the userspace API (added linux-api and linux-man
to CC for sugestions), especially including the odd effects of the
per-inode settings.

Also I would highly recommend to use different fcntl commands
for the file vs inode hints to avoid any strange behavior.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Message details and related content
On 06/26/2017 03:51 AM, Christoph Hellwig wrote:
Please document the userspace API (added linux-api and linux-man
to CC for sugestions), especially including the odd effects of the
per-inode settings.
Of course, I'll send in a diff for the fcntl(2) man page.
Also I would highly recommend to use different fcntl commands
for the file vs inode hints to avoid any strange behavior.
OK, used to have that too... I can add specific _FILE versions.

-- 
Jens Axboe
Message details and related content
On Mon, Jun 26, 2017 at 07:55:27AM -0600, Jens Axboe wrote:
On 06/26/2017 03:51 AM, Christoph Hellwig wrote:
quoted
Please document the userspace API (added linux-api and linux-man
to CC for sugestions), especially including the odd effects of the
per-inode settings.
Of course, I'll send in a diff for the fcntl(2) man page.
quoted
Also I would highly recommend to use different fcntl commands
for the file vs inode hints to avoid any strange behavior.
OK, used to have that too... I can add specific _FILE versions.
While you're at it, can you also send in an xfstest or two to check the
basic functionality of the fcntl so that we know the code reflects the
userspace API ("I set this hint and now I can query it back" and "file
hint overrides inode hint") that we want?

--D
-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Message details and related content
On 06/26/2017 10:09 AM, Darrick J. Wong wrote:
On Mon, Jun 26, 2017 at 07:55:27AM -0600, Jens Axboe wrote:
quoted
On 06/26/2017 03:51 AM, Christoph Hellwig wrote:
quoted
Please document the userspace API (added linux-api and linux-man
to CC for sugestions), especially including the odd effects of the
per-inode settings.
Of course, I'll send in a diff for the fcntl(2) man page.
quoted
Also I would highly recommend to use different fcntl commands
for the file vs inode hints to avoid any strange behavior.
OK, used to have that too... I can add specific _FILE versions.
While you're at it, can you also send in an xfstest or two to check the
basic functionality of the fcntl so that we know the code reflects the
userspace API ("I set this hint and now I can query it back" and "file
hint overrides inode hint") that we want?
I definitely can. I already wrote the below to verify that it behaves
the way it should.


/*
 * test-writehints.c: test file/inode write hint setting/getting
 */
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdbool.h>
#include <inttypes.h>
#include <assert.h>

#ifndef F_GET_RW_HINT
#define F_LINUX_SPECIFIC_BASE	1024
#define F_GET_RW_HINT		(F_LINUX_SPECIFIC_BASE + 11)
#define F_SET_RW_HINT		(F_LINUX_SPECIFIC_BASE + 12)
#define F_GET_FILE_RW_HINT	(F_LINUX_SPECIFIC_BASE + 13)
#define F_SET_FILE_RW_HINT	(F_LINUX_SPECIFIC_BASE + 14)

#define RWF_WRITE_LIFE_NOT_SET	0
#define RWH_WRITE_LIFE_NONE	1
#define RWH_WRITE_LIFE_SHORT	2
#define RWH_WRITE_LIFE_MEDIUM	3
#define RWH_WRITE_LIFE_LONG	4
#define RWH_WRITE_LIFE_EXTREME	5

#endif

static int __get_write_hint(int fd, int cmd)
{
	uint64_t hint;
	int ret;

	ret = fcntl(fd, cmd, &hint);
	if (ret < 0) {
		perror("fcntl: F_GET_RW_FILE_HINT");

103 more lines

Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help