linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@fb.com>
To: Andreas Dilger <adilger@dilger.ca>
Cc: <linux-kernel@vger.kernel.org>, <linux-fsdevel@vger.kernel.org>,
	<ming.l@ssi.samsung.com>, <david@fromorbit.com>
Subject: Re: [PATCH 2/7] Add support for per-file stream ID
Date: Sat, 18 Apr 2015 13:51:03 -0600	[thread overview]
Message-ID: <5532B5A7.60802@fb.com> (raw)
In-Reply-To: <4B03CC41-2536-4B13-8F8C-BCD9E87A74F8@dilger.ca>

On 04/09/2015 05:22 PM, Andreas Dilger wrote:
> On Mar 25, 2015, at 9:07 AM, Jens Axboe <axboe@fb.com> wrote:
>>
>> Writing on flash devices can be much more efficient, if we can
>> inform the device what kind of data can be grouped together. If
>> the device is able to group data together with similar lifetimes,
>> then it can be more efficient in garbage collection. This, in turn,
>> leads to lower write amplification, which is a win on both device
>> wear and performance.
>>
>> Add a new fadvise hint, POSIX_FADV_STREAMID, which sets the file
>> and inode streamid. The file streamid is used if we have the file
>> available at the time of the write (O_DIRECT), we use the inode
>> streamid if not (buffered writeback). The fadvise hint uses the
>> 'offset' field to specify a stream ID.
>>
>> Signed-off-by: Jens Axboe <axboe@fb.com>
>> ---
>> fs/inode.c                   |  1 +
>> fs/open.c                    |  1 +
>> include/linux/fs.h           | 23 +++++++++++++++++++++++
>> include/uapi/linux/fadvise.h |  2 ++
>> mm/fadvise.c                 | 17 +++++++++++++++++
>> 5 files changed, 44 insertions(+)
>>
>> diff --git a/fs/inode.c b/fs/inode.c
>> index f00b16f45507..41885322ba64 100644
>> --- a/fs/inode.c
>> +++ b/fs/inode.c
>> @@ -149,6 +149,7 @@ int inode_init_always(struct super_block *sb, struct inode *inode)
>> 	inode->i_blocks = 0;
>> 	inode->i_bytes = 0;
>> 	inode->i_generation = 0;
>> +	inode->i_streamid = 0;
>> 	inode->i_pipe = NULL;
>> 	inode->i_bdev = NULL;
>> 	inode->i_cdev = NULL;
>> diff --git a/fs/open.c b/fs/open.c
>> index 33f9cbf2610b..4a9b2be1a674 100644
>> --- a/fs/open.c
>> +++ b/fs/open.c
>> @@ -743,6 +743,7 @@ static int do_dentry_open(struct file *f,
>> 	f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
>>
>> 	file_ra_state_init(&f->f_ra, f->f_mapping->host->i_mapping);
>> +	f->f_streamid = 0;
>>
>> 	return 0;
>>
>> diff --git a/include/linux/fs.h b/include/linux/fs.h
>> index b4d71b5e1ff2..43dde70c1d0d 100644
>> --- a/include/linux/fs.h
>> +++ b/include/linux/fs.h
>> @@ -631,6 +631,7 @@ struct inode {
>> 	};
>>
>> 	__u32			i_generation;
>> +	unsigned int		i_streamid;
>
> Since there are only 8 bits of streamid being passed from userspace,
> is it possible to declare this as a char and pack it into a hole so
> that it doesn't increase the inode size for a functionality that most
> people won't be using?  Maybe after i_bytes?  That could be increased
> to unsigned short if needed without increasing the size of the inode.

In the next version, I've retained the int, but ensured that they pack 
better in both struct file and struct inode. Basically fill some 
existing holes.

-- 
Jens Axboe

  reply	other threads:[~2015-04-18 19:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-25 15:07 [PATCH RFC v2] Support for write stream IDs Jens Axboe
2015-03-25 15:07 ` [PATCH 1/7] block: add support for carrying a stream ID in a bio Jens Axboe
2015-04-09 22:46   ` Andreas Dilger
2015-04-18 19:53     ` Jens Axboe
2015-03-25 15:07 ` [PATCH 2/7] Add support for per-file stream ID Jens Axboe
2015-04-09  9:30   ` Dmitry Monakhov
2015-04-09 16:28     ` Jens Axboe
2015-04-09 23:22   ` Andreas Dilger
2015-04-18 19:51     ` Jens Axboe [this message]
2015-03-25 15:07 ` [PATCH 3/7] direct-io: add support for write stream IDs Jens Axboe
2015-03-25 15:07 ` [PATCH 4/7] Add stream ID support for buffered mpage/__block_write_full_page() Jens Axboe
2015-03-25 22:42   ` Ming Lin-SSI
2015-03-25 23:08     ` Jens Axboe
2015-03-25 15:07 ` [PATCH 5/7] btrfs: add support for write stream IDs Jens Axboe
2015-03-25 16:00   ` Chris Mason
2015-03-25 15:07 ` [PATCH 6/7] xfs: add support for buffered writeback stream ID Jens Axboe
2015-03-25 15:07 ` [PATCH 7/7] ext4: add support for write stream IDs Jens Axboe
2015-03-26 20:34   ` Ming Lin-SSI
2015-03-26 20:39     ` Jens Axboe
2015-03-25 16:05 ` [PATCH RFC v2] Support " Jeff Moyer
2015-03-25 16:46   ` Jens Axboe

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=5532B5A7.60802@fb.com \
    --to=axboe@fb.com \
    --cc=adilger@dilger.ca \
    --cc=david@fromorbit.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.l@ssi.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).