xfs: remove the ISUNWRITTEN macro
authorChristoph Hellwig <hch@lst.de>
Tue, 28 Mar 2017 21:53:36 +0000 (14:53 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Mon, 3 Apr 2017 22:18:16 +0000 (15:18 -0700)
Opencoding the trivial checks makes it much easier to read (and grep..).

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/libxfs/xfs_bmap_btree.h
fs/xfs/xfs_aops.c
fs/xfs/xfs_iomap.c

index 819a8a4dee952d4648ee6333a7c61ea7dff6e78f..90347a99c6d26ef28971d99342e43a5f53c46f56 100644 (file)
@@ -30,7 +30,6 @@ struct xfs_trans;
 #define XFS_EXTFMT_INODE(x)    \
        (xfs_sb_version_hasextflgbit(&((x)->i_mount->m_sb)) ? \
                XFS_EXTFMT_HASSTATE : XFS_EXTFMT_NOSTATE)
-#define ISUNWRITTEN(x) ((x)->br_state == XFS_EXT_UNWRITTEN)
 
 /*
  * Btree block header size depends on a superblock flag.
index 8567b385fff4db033e9a5b521a46586f530cd7c9..eef453adbc0698ace23640ddf6cc98fd4bdc3d42 100644 (file)
@@ -1261,8 +1261,8 @@ xfs_get_blocks(
 
        if (nimaps) {
                trace_xfs_get_blocks_found(ip, offset, size,
-                               ISUNWRITTEN(&imap) ? XFS_IO_UNWRITTEN
-                                                  : XFS_IO_OVERWRITE, &imap);
+                       imap.br_state == XFS_EXT_UNWRITTEN ?
+                               XFS_IO_UNWRITTEN : XFS_IO_OVERWRITE, &imap);
                xfs_iunlock(ip, lockmode);
        } else {
                trace_xfs_get_blocks_notfound(ip, offset, size);
index 288ee5b840d738116b8981e9618fac36fb24614f..009f8243dddc20ed39946cfbc3e9492e5543d273 100644 (file)
@@ -240,7 +240,7 @@ xfs_iomap_write_direct(
         */
        if (IS_DAX(VFS_I(ip))) {
                bmapi_flags = XFS_BMAPI_CONVERT | XFS_BMAPI_ZERO;
-               if (ISUNWRITTEN(imap)) {
+               if (imap->br_state == XFS_EXT_UNWRITTEN) {
                        tflags |= XFS_TRANS_RESERVE;
                        resblks = XFS_DIOSTRAT_SPACE_RES(mp, 0) << 1;
                }
@@ -945,7 +945,7 @@ static inline bool imap_needs_alloc(struct inode *inode,
        return !nimaps ||
                imap->br_startblock == HOLESTARTBLOCK ||
                imap->br_startblock == DELAYSTARTBLOCK ||
-               (IS_DAX(inode) && ISUNWRITTEN(imap));
+               (IS_DAX(inode) && imap->br_state == XFS_EXT_UNWRITTEN);
 }
 
 static inline bool need_excl_ilock(struct xfs_inode *ip, unsigned flags)