[Ocfs2-tools-devel] [PATCH RESEND 1/3] mkfs.ocfs2: support append direct io incompat feature
Joseph Qi
joseph.qi at huawei.com
Thu Mar 3 03:30:57 PST 2016
Turn on append direct io incompat feature by default.
Signed-off-by: Joseph Qi <joseph.qi at huawei.com>
---
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..620c6de 100644
--- a/include/ocfs2-kernel/ocfs2_fs.h
+++ b/include/ocfs2-kernel/ocfs2_fs.h
@@ -102,7 +102,8 @@
| OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS \
| OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE \
| OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG \
- | OCFS2_FEATURE_INCOMPAT_CLUSTERINFO)
+ | OCFS2_FEATURE_INCOMPAT_CLUSTERINFO \
+ | OCFS2_FEATURE_INCOMPAT_APPEND_DIO)
#define OCFS2_FEATURE_RO_COMPAT_SUPP (OCFS2_FEATURE_RO_COMPAT_UNWRITTEN \
| OCFS2_FEATURE_RO_COMPAT_USRQUOTA \
| OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)
@@ -178,6 +179,11 @@
#define OCFS2_FEATURE_INCOMPAT_CLUSTERINFO 0x4000
/*
+ * Append Direct IO support
+ */
+#define OCFS2_FEATURE_INCOMPAT_APPEND_DIO 0x8000
+
+/*
* backup superblock flag is used to indicate that this volume
* has backup superblocks.
*/
@@ -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 d33a28d..1d0ab67 100644
--- a/include/ocfs2/ocfs2.h
+++ b/include/ocfs2/ocfs2.h
@@ -1348,6 +1348,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_incompat & OCFS2_FEATURE_INCOMPAT_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..e987293 100644
--- a/libocfs2/feature_string.c
+++ b/libocfs2/feature_string.c
@@ -68,7 +68,8 @@ static ocfs2_fs_options feature_level_defaults[] = {
OCFS2_FEATURE_INCOMPAT_XATTR |
OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE |
OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS |
- OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG,
+ OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG |
+ OCFS2_FEATURE_INCOMPAT_APPEND_DIO,
OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_FEATURE_LEVEL_DEFAULT */
{OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB,
@@ -83,7 +84,8 @@ static ocfs2_fs_options feature_level_defaults[] = {
OCFS2_FEATURE_INCOMPAT_XATTR |
OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE |
OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS |
- OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG,
+ OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG |
+ OCFS2_FEATURE_INCOMPAT_APPEND_DIO,
OCFS2_FEATURE_RO_COMPAT_UNWRITTEN |
OCFS2_FEATURE_RO_COMPAT_USRQUOTA |
OCFS2_FEATURE_RO_COMPAT_GRPQUOTA }, /* OCFS2_FEATURE_LEVEL_MAX_FEATURES */
@@ -97,7 +99,8 @@ static ocfs2_fs_options mkfstypes_features_defaults[] = {
OCFS2_FEATURE_INCOMPAT_XATTR |
OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE |
OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS |
- OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG,
+ OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG |
+ OCFS2_FEATURE_INCOMPAT_APPEND_DIO,
OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_MKFSTYPE_DEFAULT */
{OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB,
@@ -107,7 +110,8 @@ static ocfs2_fs_options mkfstypes_features_defaults[] = {
OCFS2_FEATURE_INCOMPAT_XATTR |
OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE |
OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS |
- OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG,
+ OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG |
+ OCFS2_FEATURE_INCOMPAT_APPEND_DIO,
OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_MKFSTYPE_DATAFILES */
{OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB,
@@ -117,7 +121,8 @@ static ocfs2_fs_options mkfstypes_features_defaults[] = {
OCFS2_FEATURE_INCOMPAT_XATTR |
OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE |
OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS |
- OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG,
+ OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG |
+ OCFS2_FEATURE_INCOMPAT_APPEND_DIO,
OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_MKFSTYPE_MAIL */
{OCFS2_FEATURE_COMPAT_BACKUP_SB | OCFS2_FEATURE_COMPAT_JBD2_SB,
@@ -127,7 +132,8 @@ static ocfs2_fs_options mkfstypes_features_defaults[] = {
OCFS2_FEATURE_INCOMPAT_XATTR |
OCFS2_FEATURE_INCOMPAT_REFCOUNT_TREE |
OCFS2_FEATURE_INCOMPAT_INDEXED_DIRS |
- OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG,
+ OCFS2_FEATURE_INCOMPAT_DISCONTIG_BG |
+ OCFS2_FEATURE_INCOMPAT_APPEND_DIO,
OCFS2_FEATURE_RO_COMPAT_UNWRITTEN}, /* OCFS2_MKFSTYPE_VMSTORE */
};
@@ -205,6 +211,11 @@ static struct fs_feature_flags ocfs2_supported_features[] = {
{0, OCFS2_FEATURE_INCOMPAT_CLUSTERINFO, 0},
},
{
+ "append-dio",
+ {0, OCFS2_FEATURE_INCOMPAT_APPEND_DIO, 0},
+ {0, OCFS2_FEATURE_INCOMPAT_APPEND_DIO, 0},
+ },
+ {
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, OCFS2_FEATURE_INCOMPAT_APPEND_DIO, 0},
+ },
+ {
.fn_name = NULL,
},
};
--
1.8.4.3
More information about the Ocfs2-tools-devel
mailing list