Whamcloud - gitweb
LU-14776 ldiskfs: Add Ubuntu 20.04 HWE support
[fs/lustre-release.git] / lustre / osd-ldiskfs / osd_io.c
index 5d42116..33a4526 100644 (file)
@@ -2288,9 +2288,10 @@ static int osd_fallocate_preallocate(const struct lu_env *env,
        flags = osd_dev(dt->do_lu.lo_dev)->od_fallocate_zero_blocks ?
                LDISKFS_GET_BLOCKS_CREATE_ZERO :
                LDISKFS_GET_BLOCKS_CREATE_UNWRIT_EXT;
+#ifndef HAVE_LDISKFS_GET_BLOCKS_KEEP_SIZE
        if (mode & FALLOC_FL_KEEP_SIZE)
                flags |= LDISKFS_GET_BLOCKS_KEEP_SIZE;
-
+#endif
        inode_lock(inode);
 
        /*
@@ -2358,10 +2359,12 @@ static int osd_fallocate_preallocate(const struct lu_env *env,
                                epos = end;
                        if (ldiskfs_update_inode_size(inode, epos) & 0x1)
                                inode->i_mtime = inode->i_ctime;
+#ifndef HAVE_LDISKFS_GET_BLOCKS_KEEP_SIZE
                } else {
                        if (epos > inode->i_size)
                                ldiskfs_set_inode_flag(inode,
                                                       LDISKFS_INODE_EOFBLOCKS);
+#endif
                }
 
                ldiskfs_mark_inode_dirty(handle, inode);