@@ -1456,14 +1456,43 @@ xfs_inode_match_id_union(
1456
1456
return 0 ;
1457
1457
}
1458
1458
1459
+ /*
1460
+ * Is this inode @ip eligible for eof/cow block reclamation, given some
1461
+ * filtering parameters @eofb? The inode is eligible if @eofb is null or
1462
+ * if the predicate functions match.
1463
+ */
1464
+ static bool
1465
+ xfs_inode_matches_eofb (
1466
+ struct xfs_inode * ip ,
1467
+ struct xfs_eofblocks * eofb )
1468
+ {
1469
+ int match ;
1470
+
1471
+ if (!eofb )
1472
+ return true;
1473
+
1474
+ if (eofb -> eof_flags & XFS_EOF_FLAGS_UNION )
1475
+ match = xfs_inode_match_id_union (ip , eofb );
1476
+ else
1477
+ match = xfs_inode_match_id (ip , eofb );
1478
+ if (!match )
1479
+ return false;
1480
+
1481
+ /* skip the inode if the file size is too small */
1482
+ if ((eofb -> eof_flags & XFS_EOF_FLAGS_MINFILESIZE ) &&
1483
+ XFS_ISIZE (ip ) < eofb -> eof_min_file_size )
1484
+ return false;
1485
+
1486
+ return true;
1487
+ }
1488
+
1459
1489
STATIC int
1460
1490
xfs_inode_free_eofblocks (
1461
1491
struct xfs_inode * ip ,
1462
1492
void * args )
1463
1493
{
1464
1494
struct xfs_eofblocks * eofb = args ;
1465
1495
bool wait ;
1466
- int match ;
1467
1496
int ret ;
1468
1497
1469
1498
wait = eofb && (eofb -> eof_flags & XFS_EOF_FLAGS_SYNC );
@@ -1482,19 +1511,8 @@ xfs_inode_free_eofblocks(
1482
1511
if (!wait && mapping_tagged (VFS_I (ip )-> i_mapping , PAGECACHE_TAG_DIRTY ))
1483
1512
return 0 ;
1484
1513
1485
- if (eofb ) {
1486
- if (eofb -> eof_flags & XFS_EOF_FLAGS_UNION )
1487
- match = xfs_inode_match_id_union (ip , eofb );
1488
- else
1489
- match = xfs_inode_match_id (ip , eofb );
1490
- if (!match )
1491
- return 0 ;
1492
-
1493
- /* skip the inode if the file size is too small */
1494
- if (eofb -> eof_flags & XFS_EOF_FLAGS_MINFILESIZE &&
1495
- XFS_ISIZE (ip ) < eofb -> eof_min_file_size )
1496
- return 0 ;
1497
- }
1514
+ if (!xfs_inode_matches_eofb (ip , eofb ))
1515
+ return 0 ;
1498
1516
1499
1517
/*
1500
1518
* If the caller is waiting, return -EAGAIN to keep the background
@@ -1737,25 +1755,13 @@ xfs_inode_free_cowblocks(
1737
1755
void * args )
1738
1756
{
1739
1757
struct xfs_eofblocks * eofb = args ;
1740
- int match ;
1741
1758
int ret = 0 ;
1742
1759
1743
1760
if (!xfs_prep_free_cowblocks (ip ))
1744
1761
return 0 ;
1745
1762
1746
- if (eofb ) {
1747
- if (eofb -> eof_flags & XFS_EOF_FLAGS_UNION )
1748
- match = xfs_inode_match_id_union (ip , eofb );
1749
- else
1750
- match = xfs_inode_match_id (ip , eofb );
1751
- if (!match )
1752
- return 0 ;
1753
-
1754
- /* skip the inode if the file size is too small */
1755
- if (eofb -> eof_flags & XFS_EOF_FLAGS_MINFILESIZE &&
1756
- XFS_ISIZE (ip ) < eofb -> eof_min_file_size )
1757
- return 0 ;
1758
- }
1763
+ if (!xfs_inode_matches_eofb (ip , eofb ))
1764
+ return 0 ;
1759
1765
1760
1766
/* Free the CoW blocks */
1761
1767
xfs_ilock (ip , XFS_IOLOCK_EXCL );
0 commit comments