]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/ocfs2/file.c
Merge tag 'cris-for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/jesper...
[karo-tx-linux.git] / fs / ocfs2 / file.c
index 0e5b4515f92e7a875a6f396db0d5648c9c157ad1..d6312793250927b1efacf4f09c18c38f7da75e5d 100644 (file)
@@ -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;