]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
mke2fs: modify the fallback path for copying data
authorAllison Karlitskaya <allison.karlitskaya@redhat.com>
Mon, 25 Nov 2024 08:46:30 +0000 (09:46 +0100)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 23 May 2025 17:53:16 +0000 (13:53 -0400)
Right now we jump to the end as soon as we've found a method that works.
This is a reasonable approach because it's the last operation in the
function, but soon it won't be.  Switch to a logically-equivalent
alternative approach: keep trying until we find the approach that works,
dropping the `goto out`.  Now we can add code after this.

Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
misc/create_inode.c

index d3136df9327f365a49a3fc9e2e2ad7cf94cf3ec0..ca03c18470ec8f71e4810a852620080f28c2f22a 100644 (file)
@@ -600,18 +600,18 @@ static errcode_t copy_file(ext2_filsys fs, int fd, struct stat *statbuf,
 
 #if defined(SEEK_DATA) && defined(SEEK_HOLE)
        err = try_lseek_copy(fs, fd, statbuf, e2_file, buf, zerobuf);
-       if (err != EXT2_ET_UNIMPLEMENTED)
-               goto out;
+#else
+       err = EXT2_ET_UNIMPLEMENTED;
 #endif
 
 #if defined(FS_IOC_FIEMAP)
-       err = try_fiemap_copy(fs, fd, e2_file, buf, zerobuf);
-       if (err != EXT2_ET_UNIMPLEMENTED)
-               goto out;
+       if (err == EXT2_ET_UNIMPLEMENTED)
+               err = try_fiemap_copy(fs, fd, e2_file, buf, zerobuf);
 #endif
 
-       err = copy_file_chunk(fs, fd, e2_file, 0, statbuf->st_size, buf,
-                             zerobuf);
+       if (err == EXT2_ET_UNIMPLEMENTED)
+               err = copy_file_chunk(fs, fd, e2_file, 0, statbuf->st_size, buf,
+                                     zerobuf);
 out:
        ext2fs_free_mem(&zerobuf);
        ext2fs_free_mem(&buf);