2 * valid_blk.c --- does the inode have valid blocks?
4 * Copyright 1997 by Theodore Ts'o
7 * This file may be redistributed under the terms of the GNU Public
20 #if EXT2_FLAT_INCLUDES
23 #include <linux/ext2_fs.h>
29 * This function returns 1 if the inode's block entries actually
30 * contain block entries.
32 int ext2fs_inode_has_valid_blocks(struct ext2_inode *inode)
35 * Only directories, regular files, and some symbolic links
36 * have valid block entries.
38 if (!LINUX_S_ISDIR(inode->i_mode) && !LINUX_S_ISREG(inode->i_mode) &&
39 !LINUX_S_ISLNK(inode->i_mode))
43 * If the symbolic link is a "fast symlink", then the symlink
44 * target is stored in the block entries.
46 if (LINUX_S_ISLNK (inode->i_mode) && inode->i_blocks == 0 &&
47 inode->i_size < EXT2_N_BLOCKS * sizeof (unsigned long))