Dave Chinner | 0b61f8a | 2018-06-05 19:42:14 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
David Chinner | a167b17 | 2008-10-30 17:06:18 +1100 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2000-2006 Silicon Graphics, Inc. |
| 4 | * All Rights Reserved. |
David Chinner | a167b17 | 2008-10-30 17:06:18 +1100 | [diff] [blame] | 5 | */ |
David Chinner | fe4fa4b | 2008-10-30 17:06:08 +1100 | [diff] [blame] | 6 | #ifndef XFS_SYNC_H |
| 7 | #define XFS_SYNC_H 1 |
| 8 | |
David Chinner | a167b17 | 2008-10-30 17:06:18 +1100 | [diff] [blame] | 9 | struct xfs_mount; |
Christoph Hellwig | fcafb71 | 2009-02-09 08:47:34 +0100 | [diff] [blame] | 10 | struct xfs_perag; |
David Chinner | a167b17 | 2008-10-30 17:06:18 +1100 | [diff] [blame] | 11 | |
Darrick J. Wong | b26b2bf | 2021-06-07 09:34:51 -0700 | [diff] [blame] | 12 | struct xfs_icwalk { |
| 13 | __u32 icw_flags; |
| 14 | kuid_t icw_uid; |
| 15 | kgid_t icw_gid; |
| 16 | prid_t icw_prid; |
| 17 | __u64 icw_min_file_size; |
Darrick J. Wong | 10be350 | 2021-06-18 11:57:06 -0700 | [diff] [blame] | 18 | long icw_scan_limit; |
Dwight Engen | b9fe505 | 2013-08-15 14:08:02 -0400 | [diff] [blame] | 19 | }; |
| 20 | |
Darrick J. Wong | 2d53f66b | 2021-06-07 09:34:51 -0700 | [diff] [blame] | 21 | /* Flags that reflect xfs_fs_eofblocks functionality. */ |
| 22 | #define XFS_ICWALK_FLAG_SYNC (1U << 0) /* sync/wait mode scan */ |
| 23 | #define XFS_ICWALK_FLAG_UID (1U << 1) /* filter by uid */ |
| 24 | #define XFS_ICWALK_FLAG_GID (1U << 2) /* filter by gid */ |
| 25 | #define XFS_ICWALK_FLAG_PRID (1U << 3) /* filter by project id */ |
| 26 | #define XFS_ICWALK_FLAG_MINFILESIZE (1U << 4) /* filter by min file size */ |
| 27 | |
| 28 | #define XFS_ICWALK_FLAGS_VALID (XFS_ICWALK_FLAG_SYNC | \ |
| 29 | XFS_ICWALK_FLAG_UID | \ |
| 30 | XFS_ICWALK_FLAG_GID | \ |
| 31 | XFS_ICWALK_FLAG_PRID | \ |
| 32 | XFS_ICWALK_FLAG_MINFILESIZE) |
| 33 | |
Dave Chinner | 7bb85ef | 2013-08-12 20:49:34 +1000 | [diff] [blame] | 34 | /* |
| 35 | * Flags for xfs_iget() |
| 36 | */ |
| 37 | #define XFS_IGET_CREATE 0x1 |
| 38 | #define XFS_IGET_UNTRUSTED 0x2 |
| 39 | #define XFS_IGET_DONTCACHE 0x4 |
Darrick J. Wong | 378f681 | 2017-06-19 08:58:56 -0700 | [diff] [blame] | 40 | #define XFS_IGET_INCORE 0x8 /* don't read from disk or reinit */ |
Dave Chinner | 7bb85ef | 2013-08-12 20:49:34 +1000 | [diff] [blame] | 41 | |
Dave Chinner | 33479e0 | 2012-10-08 21:56:11 +1100 | [diff] [blame] | 42 | int xfs_iget(struct xfs_mount *mp, struct xfs_trans *tp, xfs_ino_t ino, |
| 43 | uint flags, uint lock_flags, xfs_inode_t **ipp); |
| 44 | |
Dave Chinner | 638f4416 | 2013-08-30 10:23:45 +1000 | [diff] [blame] | 45 | /* recovery needs direct inode allocation capability */ |
| 46 | struct xfs_inode * xfs_inode_alloc(struct xfs_mount *mp, xfs_ino_t ino); |
| 47 | void xfs_inode_free(struct xfs_inode *ip); |
| 48 | |
Dave Chinner | 33c7a2b | 2012-10-08 21:55:59 +1100 | [diff] [blame] | 49 | void xfs_reclaim_worker(struct work_struct *work); |
David Chinner | a167b17 | 2008-10-30 17:06:18 +1100 | [diff] [blame] | 50 | |
Dave Chinner | 4d0bab3 | 2020-07-01 10:21:28 -0700 | [diff] [blame] | 51 | void xfs_reclaim_inodes(struct xfs_mount *mp); |
Darrick J. Wong | 10be350 | 2021-06-18 11:57:06 -0700 | [diff] [blame] | 52 | long xfs_reclaim_inodes_count(struct xfs_mount *mp); |
| 53 | long xfs_reclaim_inodes_nr(struct xfs_mount *mp, unsigned long nr_to_scan); |
David Chinner | fce08f2 | 2008-10-30 17:37:03 +1100 | [diff] [blame] | 54 | |
Darrick J. Wong | c076ae7 | 2021-05-31 11:32:02 -0700 | [diff] [blame] | 55 | void xfs_inode_mark_reclaimable(struct xfs_inode *ip); |
Christoph Hellwig | fe588ed | 2009-06-08 15:35:27 +0200 | [diff] [blame] | 56 | |
Darrick J. Wong | c237dd7 | 2021-01-22 16:48:37 -0800 | [diff] [blame] | 57 | int xfs_blockgc_free_dquots(struct xfs_mount *mp, struct xfs_dquot *udqp, |
| 58 | struct xfs_dquot *gdqp, struct xfs_dquot *pdqp, |
Darrick J. Wong | 2d53f66b | 2021-06-07 09:34:51 -0700 | [diff] [blame] | 59 | unsigned int iwalk_flags); |
| 60 | int xfs_blockgc_free_quota(struct xfs_inode *ip, unsigned int iwalk_flags); |
Darrick J. Wong | b26b2bf | 2021-06-07 09:34:51 -0700 | [diff] [blame] | 61 | int xfs_blockgc_free_space(struct xfs_mount *mp, struct xfs_icwalk *icm); |
Darrick J. Wong | e8d04c2 | 2021-08-06 11:05:42 -0700 | [diff] [blame] | 62 | void xfs_blockgc_flush_all(struct xfs_mount *mp); |
Darrick J. Wong | a636b1d | 2021-01-22 16:48:34 -0800 | [diff] [blame] | 63 | |
Brian Foster | 27b5286 | 2012-11-06 09:50:38 -0500 | [diff] [blame] | 64 | void xfs_inode_set_eofblocks_tag(struct xfs_inode *ip); |
| 65 | void xfs_inode_clear_eofblocks_tag(struct xfs_inode *ip); |
| 66 | |
Darrick J. Wong | 83104d4 | 2016-10-03 09:11:46 -0700 | [diff] [blame] | 67 | void xfs_inode_set_cowblocks_tag(struct xfs_inode *ip); |
| 68 | void xfs_inode_clear_cowblocks_tag(struct xfs_inode *ip); |
Darrick J. Wong | 9669f51 | 2021-01-22 16:48:43 -0800 | [diff] [blame] | 69 | |
| 70 | void xfs_blockgc_worker(struct work_struct *work); |
Darrick J. Wong | 83104d4 | 2016-10-03 09:11:46 -0700 | [diff] [blame] | 71 | |
Darrick J. Wong | 378f681 | 2017-06-19 08:58:56 -0700 | [diff] [blame] | 72 | int xfs_icache_inode_is_allocated(struct xfs_mount *mp, struct xfs_trans *tp, |
| 73 | xfs_ino_t ino, bool *inuse); |
| 74 | |
Darrick J. Wong | c9a6526 | 2021-01-22 16:48:44 -0800 | [diff] [blame] | 75 | void xfs_blockgc_stop(struct xfs_mount *mp); |
| 76 | void xfs_blockgc_start(struct xfs_mount *mp); |
Darrick J. Wong | d6b636e | 2018-05-09 10:03:56 -0700 | [diff] [blame] | 77 | |
Dave Chinner | ab23a77 | 2021-08-06 11:05:39 -0700 | [diff] [blame] | 78 | void xfs_inodegc_worker(struct work_struct *work); |
| 79 | void xfs_inodegc_flush(struct xfs_mount *mp); |
| 80 | void xfs_inodegc_stop(struct xfs_mount *mp); |
| 81 | void xfs_inodegc_start(struct xfs_mount *mp); |
| 82 | void xfs_inodegc_cpu_dead(struct xfs_mount *mp, unsigned int cpu); |
Darrick J. Wong | 40b1de007 | 2021-08-06 11:05:43 -0700 | [diff] [blame] | 83 | int xfs_inodegc_register_shrinker(struct xfs_mount *mp); |
Dave Chinner | ab23a77 | 2021-08-06 11:05:39 -0700 | [diff] [blame] | 84 | |
David Chinner | fe4fa4b | 2008-10-30 17:06:08 +1100 | [diff] [blame] | 85 | #endif |