summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_icache.c
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2012-11-07 12:21:13 -0500
committerBen Myers <bpm@sgi.com>2012-11-08 15:29:14 -0600
commit3e3f9f5863548e870edfcc72e7617ac8ddcad44a (patch)
treeab1952acea4c3cad7048d6c168987ba7b7e73552 /fs/xfs/xfs_icache.c
parent8ca149de80478441352a8622ea15fae7de703ced (diff)
downloadlinux-3e3f9f5863548e870edfcc72e7617ac8ddcad44a.tar.bz2
xfs: add inode id filtering to eofblocks scan
Support inode ID filtering in the eofblocks scan. The caller must set the associated XFS_EOF_FLAGS_*ID bit and ID field. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Mark Tinguely <tinguely@sgi.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_icache.c')
-rw-r--r--fs/xfs/xfs_icache.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index fbb74c715266..b239da91c43b 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -1171,6 +1171,21 @@ xfs_reclaim_inodes_count(
}
STATIC int
+xfs_inode_match_id(
+ struct xfs_inode *ip,
+ struct xfs_eofblocks *eofb)
+{
+ if (eofb->eof_flags & XFS_EOF_FLAGS_UID)
+ return ip->i_d.di_uid == eofb->eof_uid;
+ else if (eofb->eof_flags & XFS_EOF_FLAGS_GID)
+ return ip->i_d.di_gid == eofb->eof_gid;
+ else if (eofb->eof_flags & XFS_EOF_FLAGS_PRID)
+ return xfs_get_projid(ip) == eofb->eof_prid;
+
+ return 0;
+}
+
+STATIC int
xfs_inode_free_eofblocks(
struct xfs_inode *ip,
struct xfs_perag *pag,
@@ -1178,6 +1193,7 @@ xfs_inode_free_eofblocks(
void *args)
{
int ret;
+ struct xfs_eofblocks *eofb = args;
if (!xfs_can_free_eofblocks(ip, false)) {
/* inode could be preallocated or append-only */
@@ -1194,6 +1210,12 @@ xfs_inode_free_eofblocks(
mapping_tagged(VFS_I(ip)->i_mapping, PAGECACHE_TAG_DIRTY))
return 0;
+ if (eofb &&
+ (eofb->eof_flags & (XFS_EOF_FLAGS_UID|XFS_EOF_FLAGS_GID|
+ XFS_EOF_FLAGS_PRID)) &&
+ !xfs_inode_match_id(ip, eofb))
+ return 0;
+
ret = xfs_free_eofblocks(ip->i_mount, ip, true);
/* don't revisit the inode if we're not waiting */