diff options
author | John Haxby <john.haxby@oracle.com> | 2016-01-14 15:17:12 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-14 16:00:49 -0800 |
commit | d6364627eff4c9a2035cebb3aec7415705ba117b (patch) | |
tree | a88edb8e4b9538378b4f667e037fdd3c0e5f51cc /fs/ocfs2 | |
parent | 3eb5bdf0f47726e3ef0a875e0cce3cca462ee70d (diff) | |
download | op-kernel-dev-d6364627eff4c9a2035cebb3aec7415705ba117b.zip op-kernel-dev-d6364627eff4c9a2035cebb3aec7415705ba117b.tar.gz |
ocfs2: return non-zero st_blocks for inline data
Some versions of tar assume that files with st_blocks == 0 do not
contain any data and will skip reading them entirely. See also commit
9206c561554c ("ext4: return non-zero st_blocks for inline data").
Signed-off-by: John Haxby <john.haxby@oracle.com>
Reviewed-by: Mark Fasheh <mfasheh@suse.de>
Cc: Joel Becker <jlbec@evilplan.org>
Acked-by: Gang He <ghe@suse.com>
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/file.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 0e5b451..d631279 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -1302,6 +1302,14 @@ int ocfs2_getattr(struct vfsmount *mnt, } generic_fillattr(inode, stat); + /* + * If there is inline data in the inode, the inode will normally not + * have data blocks allocated (it may have an external xattr block). + * Report at least one sector for such files, so tools like tar, rsync, + * others don't incorrectly think the file is completely sparse. + */ + if (unlikely(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)) + stat->blocks += (stat->size + 511)>>9; /* We set the blksize from the cluster size for performance */ stat->blksize = osb->s_clustersize; |