]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/f2fs/file.c
f2fs: fix not to allocate unnecessary blocks during fallocate
[karo-tx-linux.git] / fs / f2fs / file.c
index f6c4bdaaae86c2500b8dbf5e3cef348f2c9585df..7d8b96275092a1109b1bfcb6f4bd07ef7d738f82 100644 (file)
@@ -664,11 +664,14 @@ static int expand_inode_data(struct inode *inode, loff_t offset,
        for (index = pg_start; index <= pg_end; index++) {
                struct dnode_of_data dn;
 
+               if (index == pg_end && !off_end)
+                       goto noalloc;
+
                set_new_dnode(&dn, inode, NULL, NULL, 0);
                ret = f2fs_reserve_block(&dn, index);
                if (ret)
                        break;
-
+noalloc:
                if (pg_start == pg_end)
                        new_size = offset + len;
                else if (index == pg_start && off_start)