Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: change return value of xfs_inode_need_cow to int

Fixes coccicheck warning:

fs/xfs/xfs_reflink.c:236:9-10: WARNING: return of 0/1 in function 'xfs_inode_need_cow' with return type bool

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
[darrick: rename the function so it doesn't sound like a predicate]
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

authored by

zhengbin and committed by
Darrick J. Wong
aa124436 8a6453a8

+5 -5
+1 -1
fs/xfs/xfs_iomap.c
··· 923 923 xfs_trim_extent(&imap, offset_fsb, end_fsb - offset_fsb); 924 924 925 925 /* Trim the mapping to the nearest shared extent boundary. */ 926 - error = xfs_inode_need_cow(ip, &imap, &shared); 926 + error = xfs_bmap_trim_cow(ip, &imap, &shared); 927 927 if (error) 928 928 goto out_unlock; 929 929
+3 -3
fs/xfs/xfs_reflink.c
··· 223 223 } 224 224 } 225 225 226 - bool 227 - xfs_inode_need_cow( 226 + int 227 + xfs_bmap_trim_cow( 228 228 struct xfs_inode *ip, 229 229 struct xfs_bmbt_irec *imap, 230 230 bool *shared) ··· 327 327 if (cmap->br_startoff > offset_fsb) { 328 328 xfs_trim_extent(imap, imap->br_startoff, 329 329 cmap->br_startoff - imap->br_startoff); 330 - return xfs_inode_need_cow(ip, imap, shared); 330 + return xfs_bmap_trim_cow(ip, imap, shared); 331 331 } 332 332 333 333 *shared = true;
+1 -1
fs/xfs/xfs_reflink.h
··· 22 22 xfs_agblock_t *fbno, xfs_extlen_t *flen, bool find_maximal); 23 23 extern int xfs_reflink_trim_around_shared(struct xfs_inode *ip, 24 24 struct xfs_bmbt_irec *irec, bool *shared); 25 - bool xfs_inode_need_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap, 25 + int xfs_bmap_trim_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap, 26 26 bool *shared); 27 27 28 28 int xfs_reflink_allocate_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap,