]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - fs/xfs/xfs_inode.h
[XFS] Fix to prevent the notorious 'NULL files' problem after a crash.
[mirror_ubuntu-bionic-kernel.git] / fs / xfs / xfs_inode.h
index bc823720d88f4116bff4eccc42fb07b6d1ab971d..cfe7b58c4533210012d54b410788cbfc4f4bd52d 100644 (file)
@@ -287,6 +287,7 @@ typedef struct xfs_inode {
        struct xfs_inode        *i_cnext;       /* cluster hash link forward */
        struct xfs_inode        *i_cprev;       /* cluster hash link backward */
 
+       xfs_fsize_t             i_size;         /* in-memory size */
        /* Trace buffers per inode. */
 #ifdef XFS_BMAP_TRACE
        struct ktrace           *i_xtrace;      /* inode extent list trace */
@@ -305,6 +306,8 @@ typedef struct xfs_inode {
 #endif
 } xfs_inode_t;
 
+#define XFS_ISIZE(ip)  (((ip)->i_d.di_mode & S_IFMT) == S_IFREG) ? \
+                               (ip)->i_size : (ip)->i_d.di_size;
 
 /*
  * i_flags helper functions
@@ -481,7 +484,7 @@ uint                xfs_ip2xflags(struct xfs_inode *);
 uint           xfs_dic2xflags(struct xfs_dinode_core *);
 int            xfs_ifree(struct xfs_trans *, xfs_inode_t *,
                           struct xfs_bmap_free *);
-void           xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t);
+int            xfs_itruncate_start(xfs_inode_t *, uint, xfs_fsize_t);
 int            xfs_itruncate_finish(struct xfs_trans **, xfs_inode_t *,
                                     xfs_fsize_t, int, int);
 int            xfs_iunlink(struct xfs_trans *, xfs_inode_t *);