From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753237AbbCXP1Q (ORCPT ); Tue, 24 Mar 2015 11:27:16 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:55842 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752326AbbCXP1J (ORCPT ); Tue, 24 Mar 2015 11:27:09 -0400 From: Jens Axboe To: , , CC: Subject: [PATCH RFC] Support for write stream IDs Date: Tue, 24 Mar 2015 09:26:57 -0600 Message-ID: <1427210823-5283-1-git-send-email-axboe@fb.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.54.13] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-03-24_04:2015-03-24,2015-03-24,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.925924926977281 suspectscore=0 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0.925924926977281 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.925924926977281 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1503240151 X-FB-Internal: deliver Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, One of the things that exacerbates write amplification on flash based devices is that fact that data with different lifetimes get grouped together on media. Currently we have no interface that applications can use to separate different types of writes. This patch set adds support for that. The kernel has no knowledge of what stream ID is what. The idea is that writes with identical stream IDs have similar life times, not that stream ID 'X' has a shorter lifetime than stream ID 'X+1'. There are basically two interfaces that could be used for this. One is fcntl, the other is fadvise. This patchset uses fadvise, with a new POSIX_FADV_STREAMID hint. The 'offset' field is used to pass the relevant stream ID. Switching to fcntl (with a SET/GET_STREAMID) would be trivial. The patchset wires up the block parts, adds buffered and O_DIRECT support, and modifies btrfs/xfs too. It should be trivial to extend this to all other file systems, I just used xfs and btrfs for testing. No block drivers are wired up yet. Patches are against current -git. block/bio.c | 2 ++ block/blk-core.c | 3 +++ fs/btrfs/inode.c | 1 + fs/buffer.c | 4 ++-- fs/direct-io.c | 4 ++++ fs/fs-writeback.c | 1 + fs/inode.c | 1 + fs/mpage.c | 1 + fs/open.c | 1 + fs/xfs/xfs_aops.c | 1 + include/linux/blk_types.h | 28 +++++++++++++++++++++++++++- include/linux/fs.h | 11 +++++++++++ include/linux/writeback.h | 2 ++ include/uapi/linux/fadvise.h | 2 ++ mm/fadvise.c | 17 +++++++++++++++++ mm/filemap.c | 1 + mm/migrate.c | 1 + mm/page-writeback.c | 1 + mm/vmscan.c | 1 + 19 files changed, 80 insertions(+), 3 deletions(-)