}
pctx->num = 0;
}
- if (LINUX_S_ISREG(inode->i_mode) && EXT2_I_SIZE(inode) >= 0x80000000UL)
+ if (LINUX_S_ISREG(inode->i_mode) &&
+ ext2fs_needs_large_file_feature(EXT2_I_SIZE(inode)))
ctx->large_files++;
if ((pb.num_blocks != ext2fs_inode_i_blocks(fs, inode)) ||
((fs->super->s_feature_ro_compat &
if (!ext2fs_inode_has_valid_blocks2(fs, &inode))
goto clear_inode;
- if (LINUX_S_ISREG(inode.i_mode) && EXT2_I_SIZE(&inode) >= 0x80000000UL)
+ if (LINUX_S_ISREG(inode.i_mode) &&
+ ext2fs_needs_large_file_feature(EXT2_I_SIZE(&inode)))
ctx->large_files--;
del_block.ctx = ctx;
* function prototypes
*/
+/* The LARGE_FILE feature should be set if we have stored files 2GB+ in size */
+static inline int ext2fs_needs_large_file_feature(unsigned long long file_size)
+{
+ return file_size >= 0x80000000ULL;
+}
+
/* alloc.c */
extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode,
ext2fs_inode_bitmap map, ext2_ino_t *ret);
/* If we're writing a large file, set the large_file flag */
if (LINUX_S_ISREG(file->inode.i_mode) &&
- EXT2_I_SIZE(&file->inode) > 0x7FFFFFFULL &&
+ ext2fs_needs_large_file_feature(EXT2_I_SIZE(&file->inode)) &&
(!EXT2_HAS_RO_COMPAT_FEATURE(file->fs->super,
EXT2_FEATURE_RO_COMPAT_LARGE_FILE) ||
file->fs->super->s_rev_level == EXT2_GOOD_OLD_REV)) {
inode_size = (unsigned long long)fs->blocksize * num_blocks;
inode.i_size = inode_size & 0xFFFFFFFF;
inode.i_size_high = (inode_size >> 32) & 0xFFFFFFFF;
- if (inode.i_size_high)
+ if (ext2fs_needs_large_file_feature(inode_size))
fs->super->s_feature_ro_compat |=
EXT2_FEATURE_RO_COMPAT_LARGE_FILE;
ext2fs_iblk_add_blocks(fs, &inode, es.newblocks);