|
@@ -2212,6 +2212,15 @@ static int ocfs2_prepare_inode_for_write(struct file *file,
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ * Fallback to old way if the feature bit is not set.
|
|
|
+ */
|
|
|
+ if (end > i_size_read(inode) &&
|
|
|
+ !ocfs2_supports_append_dio(osb)) {
|
|
|
+ *direct_io = 0;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
/*
|
|
|
* We don't fill holes during direct io, so
|
|
|
* check for them here. If any are found, the
|
|
@@ -2220,7 +2229,13 @@ static int ocfs2_prepare_inode_for_write(struct file *file,
|
|
|
*/
|
|
|
ret = ocfs2_check_range_for_holes(inode, saved_pos, count);
|
|
|
if (ret == 1) {
|
|
|
- *direct_io = 0;
|
|
|
+ /*
|
|
|
+ * Fallback to old way if the feature bit is not set.
|
|
|
+ * Otherwise try dio first and then complete the rest
|
|
|
+ * request through buffer io.
|
|
|
+ */
|
|
|
+ if (!ocfs2_supports_append_dio(osb))
|
|
|
+ *direct_io = 0;
|
|
|
ret = 0;
|
|
|
} else if (ret < 0)
|
|
|
mlog_errno(ret);
|