Whamcloud - gitweb
LU-14382 mdt: implement fallocate in MDC/MDT
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_io.c
index 33a4526..59a92eb 100644 (file)
@@ -2285,7 +2285,8 @@ static int osd_fallocate_preallocate(const struct lu_env *env,
        blen = (ALIGN(end, 1 << inode->i_blkbits) >> inode->i_blkbits) - boff;
 
        /* Create and mark new extents as either zero or unwritten */
-       flags = osd_dev(dt->do_lu.lo_dev)->od_fallocate_zero_blocks ?
+       flags = (osd_dev(dt->do_lu.lo_dev)->od_fallocate_zero_blocks ||
+                !ldiskfs_test_inode_flag(inode, LDISKFS_INODE_EXTENTS)) ?
                LDISKFS_GET_BLOCKS_CREATE_ZERO :
                LDISKFS_GET_BLOCKS_CREATE_UNWRIT_EXT;
 #ifndef HAVE_LDISKFS_GET_BLOCKS_KEEP_SIZE
@@ -2294,12 +2295,6 @@ static int osd_fallocate_preallocate(const struct lu_env *env,
 #endif
        inode_lock(inode);
 
-       /*
-        * We only support preallocation for extent-based file only.
-        */
-       if (!(ldiskfs_test_inode_flag(inode, LDISKFS_INODE_EXTENTS)))
-               GOTO(out, rc = -EOPNOTSUPP);
-
        if (!(mode & FALLOC_FL_KEEP_SIZE) && (end > i_size_read(inode) ||
            end > LDISKFS_I(inode)->i_disksize)) {
                new_size = end;