From patchwork Mon Feb 2 02:57:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Qi X-Patchwork-Id: 5758881 Return-Path: X-Original-To: patchwork-ocfs2-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 633E7BF440 for ; Mon, 2 Feb 2015 02:58:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 72BCB20218 for ; Mon, 2 Feb 2015 02:58:41 +0000 (UTC) Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 481102012E for ; Mon, 2 Feb 2015 02:58:40 +0000 (UTC) Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t122w1gc002554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 2 Feb 2015 02:58:01 GMT Received: from oss.oracle.com (oss-old-reserved.oracle.com [137.254.22.2]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t122w0uA024472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 2 Feb 2015 02:58:00 GMT Received: from localhost ([127.0.0.1] helo=lb-oss.oracle.com) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1YI7D6-0008G5-7x; Sun, 01 Feb 2015 18:58:00 -0800 Received: from acsinet22.oracle.com ([141.146.126.238]) by oss.oracle.com with esmtp (Exim 4.63) (envelope-from ) id 1YI7D0-0008Ef-Bk; Sun, 01 Feb 2015 18:57:54 -0800 Received: from aserp1020.oracle.com (aserp1020.oracle.com [141.146.126.67]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t122vs6p023996 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 2 Feb 2015 02:57:54 GMT Received: from userp2040.oracle.com (userp2040.oracle.com [156.151.31.90]) by aserp1020.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t122vrPe014415 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 2 Feb 2015 02:57:53 GMT Received: from pps.filterd (userp2040.oracle.com [127.0.0.1]) by userp2040.oracle.com (8.14.7/8.14.7) with SMTP id t122vqiG034428; Mon, 2 Feb 2015 02:57:53 GMT Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [119.145.14.65]) by userp2040.oracle.com with ESMTP id 1s9ngsbsvv-1 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT); Mon, 02 Feb 2015 02:57:52 +0000 Received: from 172.24.2.119 (EHLO szxeml433-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CGR49746; Mon, 02 Feb 2015 10:57:49 +0800 (CST) Received: from [127.0.0.1] (10.177.24.125) by szxeml433-hub.china.huawei.com (10.82.67.210) with Microsoft SMTP Server id 14.3.158.1; Mon, 2 Feb 2015 10:57:44 +0800 Message-ID: <54CEE7A7.8020204@huawei.com> Date: Mon, 2 Feb 2015 10:57:43 +0800 From: Joseph Qi User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: "ocfs2-devel@oss.oracle.com" , X-Originating-IP: [10.177.24.125] X-CFilter-Loop: Reflected X-ServerName: szxga02-in.huawei.com X-Proofpoint-Virus-Version: vendor=nai engine=5600 definitions=7699 signatures=670623 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=2 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1502020032 Subject: [Ocfs2-devel] [PATCH 1/3] mkfs.ocfs2: support append direct io ro compat feature X-BeenThere: ocfs2-devel@oss.oracle.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ocfs2-devel-bounces@oss.oracle.com Errors-To: ocfs2-devel-bounces@oss.oracle.com X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Turn on append direct io ro compat feature when fromatting a new volume by default. Signed-off-by: Joseph Qi --- include/ocfs2-kernel/ocfs2_fs.h | 14 ++++++++++++-- include/ocfs2/ocfs2.h | 7 +++++++ libocfs2/feature_string.c | 27 +++++++++++++++++++++------ 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/include/ocfs2-kernel/ocfs2_fs.h b/include/ocfs2-kernel/ocfs2_fs.h index 79e4f2f..b80f046 100644 --- a/include/ocfs2-kernel/ocfs2_fs.h +++ b/include/ocfs2-kernel/ocfs2_fs.h @@ -105,7 +105,8 @@ | OCFS2_FEATURE_INCOMPAT_CLUSTERINFO) #define OCFS2_FEATURE_RO_COMPAT_SUPP (OCFS2_FEATURE_RO_COMPAT_UNWRITTEN \ | OCFS2_FEATURE_RO_COMPAT_USRQUOTA \ - | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA) + | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA \ + | OCFS2_FEATURE_RO_COMPAT_APPEND_DIO) /* * Heartbeat-only devices are missing journals and other files. The @@ -199,6 +200,11 @@ #define OCFS2_FEATURE_RO_COMPAT_USRQUOTA 0x0002 #define OCFS2_FEATURE_RO_COMPAT_GRPQUOTA 0x0004 +/* + * Append Direct IO support + */ +#define OCFS2_FEATURE_RO_COMPAT_APPEND_DIO 0x0008 + /* The byte offset of the first backup block will be 1G. * The following will be 4G, 16G, 64G, 256G and 1T. */ @@ -232,6 +238,8 @@ #define OCFS2_CHAIN_FL (0x00000400) /* Chain allocator */ #define OCFS2_DEALLOC_FL (0x00000800) /* Truncate log */ #define OCFS2_QUOTA_FL (0x00001000) /* Quota file */ +#define OCFS2_DIO_ORPHANED_FL (0X00002000) /* On the orphan list especially + * for dio */ /* * Flags on ocfs2_dinode.i_dyn_features @@ -737,7 +745,9 @@ struct ocfs2_dinode { inode belongs to. Only valid if allocated from a discontiguous block group */ -/*A0*/ __le64 i_reserved2[3]; +/*A0*/ __le16 i_dio_orphaned_slot; /* only used for append dio write */ + __le16 i_reserved1[3]; + __le64 i_reserved2[2]; /*B8*/ union { __le64 i_pad1; /* Generic way to refer to this 64bit union */ diff --git a/include/ocfs2/ocfs2.h b/include/ocfs2/ocfs2.h index 3b54880..f4300e3 100644 --- a/include/ocfs2/ocfs2.h +++ b/include/ocfs2/ocfs2.h @@ -1346,6 +1346,13 @@ static inline int ocfs2_writes_unwritten_extents(struct ocfs2_super_block *osb) return 0; } +static inline int ocfs2_supports_append_dio(struct ocfs2_super_block *osb) +{ + if (osb->s_feature_ro_compat & OCFS2_FEATURE_RO_COMPAT_APPEND_DIO) + return 1; + return 0; +} + static inline int ocfs2_uses_extended_slot_map(struct ocfs2_super_block *osb) { if (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP) diff --git a/libocfs2/feature_string.c b/libocfs2/feature_string.c index 544cc6e..97a4454 100644 --- a/libocfs2/feature_string.c +++ b/libocfs2/feature_string.c @@ -69,7 +69,8 @@ static ocfs2_fs_options feature_level_defaults[] = { OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE | OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS | OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG, - OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_FEATURE_LEVEL_DEFAULT */ + OCFS2_FEATURE_RO_COMPAT_UNWRITTEN | + OCFS2_FEATURE_RO_COMPAT_APPEND_DIO}, /* OCFS2_FEATURE_LEVEL_DEFAULT */ {OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB, 0, @@ -86,7 +87,8 @@ static ocfs2_fs_options feature_level_defaults[] = { OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG, OCFS2_FEATURE_RO_COMPAT_UNWRITTEN | OCFS2_FEATURE_RO_COMPAT_USRQUOTA | - OCFS2_FEATURE_RO_COMPAT_GRPQUOTA }, /* OCFS2_FEATURE_LEVEL_MAX_FEATURES */ + OCFS2_FEATURE_RO_COMPAT_GRPQUOTA | + OCFS2_FEATURE_RO_COMPAT_APPEND_DIO}, /* OCFS2_FEATURE_LEVEL_MAX_FEATURES */ }; static ocfs2_fs_options mkfstypes_features_defaults[] = { @@ -98,7 +100,8 @@ static ocfs2_fs_options mkfstypes_features_defaults[] = { OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE | OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS | OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG, - OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_MKFSTYPE_DEFAULT */ + OCFS2_FEATURE_RO_COMPAT_UNWRITTEN | + OCFS2_FEATURE_RO_COMPAT_APPEND_DIO}, /* OCFS2_MKFSTYPE_DEFAULT */ {OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB, OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC | @@ -108,7 +111,8 @@ static ocfs2_fs_options mkfstypes_features_defaults[] = { OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE | OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS | OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG, - OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_MKFSTYPE_DATAFILES */ + OCFS2_FEATURE_RO_COMPAT_UNWRITTEN | + OCFS2_FEATURE_RO_COMPAT_APPEND_DIO}, /* OCFS2_MKFSTYPE_DATAFILES */ {OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB, OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC | @@ -118,7 +122,8 @@ static ocfs2_fs_options mkfstypes_features_defaults[] = { OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE | OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS | OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG, - OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_MKFSTYPE_MAIL */ + OCFS2_FEATURE_RO_COMPAT_UNWRITTEN | + OCFS2_FEATURE_RO_COMPAT_APPEND_DIO}, /* OCFS2_MKFSTYPE_MAIL */ {OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB, OCFS2_FEATURE_INCOMPAT_SPARSE_ALLOC | @@ -128,7 +133,8 @@ static ocfs2_fs_options mkfstypes_features_defaults[] = { OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE | OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS | OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG, - OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_MKFSTYPE_VMSTORE */ + OCFS2_FEATURE_RO_COMPAT_UNWRITTEN | + OCFS2_FEATURE_RO_COMPAT_APPEND_DIO}, /* OCFS2_MKFSTYPE_VMSTORE */ }; /* These are the features we support in mkfs/tunefs via --fs-features */ @@ -205,6 +211,11 @@ static struct fs_feature_flags ocfs2_supported_features[] = { {0, OCFS2_FEATURE_INCOMPAT_CLUSTERINFO, 0}, }, { + "append-dio", + {0, 0, OCFS2_FEATURE_RO_COMPAT_APPEND_DIO}, + {0, 0, OCFS2_FEATURE_RO_COMPAT_APPEND_DIO}, + }, + { NULL, {0, 0, 0}, {0, 0, 0} @@ -296,6 +307,10 @@ static struct feature_name ocfs2_feature_names[] = { .fn_flag = {0, OCFS2_FEATURE_INCOMPAT_CLUSTERINFO, 0}, }, { + .fn_name = "append-dio", + .fn_flag = {0, 0, OCFS2_FEATURE_RO_COMPAT_APPEND_DIO}, + }, + { .fn_name = NULL, }, };