Whamcloud - gitweb
libext2fs: handle inline_data in block iterator by returning an error code
authorTheodore Ts'o <tytso@mit.edu>
Sun, 13 Oct 2013 21:42:25 +0000 (17:42 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 14 Oct 2013 01:43:41 +0000 (21:43 -0400)
An inode with inline data has no data blocks, so we can not iterate
over such an inode.  Return an error code which indicates this fact;
callers can use this to determine whether or not the inode has inline
data, and then call some routine to iterate over the directory intries
in the line data or read the inline data, as appropriate.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
lib/ext2fs/block.c
lib/ext2fs/ext2_err.et.in

index b8c6879..601129d 100644 (file)
@@ -345,6 +345,13 @@ errcode_t ext2fs_block_iterate3(ext2_filsys fs,
                return ctx.errcode;
 
        /*
+        * An inode with inline data has no blocks over which to
+        * iterate, so return an error code indicating this fact.
+        */
+       if (inode.i_flags & EXT4_INLINE_DATA_FL)
+               return EXT2_ET_INLINE_DATA_CANT_ITERATE;
+
+       /*
         * Check to see if we need to limit large files
         */
        if (flags & BLOCK_FLAG_NO_LARGE) {
index c547a2c..9cc1bd1 100644 (file)
@@ -479,4 +479,7 @@ ec  EXT2_ET_FILE_EXISTS,
 ec     EXT2_ET_BLOCK_BITMAP_CSUM_INVALID,
        "Block bitmap checksum does not match bitmap"
 
+ec     EXT2_ET_INLINE_DATA_CANT_ITERATE,
+       "Cannot block iterate on an inode containing inline data"
+
        end