blob: 2e4cfddf8b8ed8faeb49bd5c54e0c501fb2b4b8c [file] [log] [blame]
Dave Chinner0b61f8a2018-06-05 19:42:14 -07001// SPDX-License-Identifier: GPL-2.0
David Chinnera167b172008-10-30 17:06:18 +11002/*
3 * Copyright (c) 2000-2006 Silicon Graphics, Inc.
4 * All Rights Reserved.
David Chinnera167b172008-10-30 17:06:18 +11005 */
David Chinnerfe4fa4b2008-10-30 17:06:08 +11006#ifndef XFS_SYNC_H
7#define XFS_SYNC_H 1
8
David Chinnera167b172008-10-30 17:06:18 +11009struct xfs_mount;
Christoph Hellwigfcafb712009-02-09 08:47:34 +010010struct xfs_perag;
David Chinnera167b172008-10-30 17:06:18 +110011
Darrick J. Wongb26b2bf2021-06-07 09:34:51 -070012struct 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. Wong10be3502021-06-18 11:57:06 -070018 long icw_scan_limit;
Dwight Engenb9fe5052013-08-15 14:08:02 -040019};
20
Darrick J. Wong2d53f66b2021-06-07 09:34:51 -070021/* 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 Chinner7bb85ef2013-08-12 20:49:34 +100034/*
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. Wong378f6812017-06-19 08:58:56 -070040#define XFS_IGET_INCORE 0x8 /* don't read from disk or reinit */
Dave Chinner7bb85ef2013-08-12 20:49:34 +100041
Dave Chinner33479e02012-10-08 21:56:11 +110042int 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 Chinner638f44162013-08-30 10:23:45 +100045/* recovery needs direct inode allocation capability */
46struct xfs_inode * xfs_inode_alloc(struct xfs_mount *mp, xfs_ino_t ino);
47void xfs_inode_free(struct xfs_inode *ip);
48
Dave Chinner33c7a2b2012-10-08 21:55:59 +110049void xfs_reclaim_worker(struct work_struct *work);
David Chinnera167b172008-10-30 17:06:18 +110050
Dave Chinner4d0bab32020-07-01 10:21:28 -070051void xfs_reclaim_inodes(struct xfs_mount *mp);
Darrick J. Wong10be3502021-06-18 11:57:06 -070052long xfs_reclaim_inodes_count(struct xfs_mount *mp);
53long xfs_reclaim_inodes_nr(struct xfs_mount *mp, unsigned long nr_to_scan);
David Chinnerfce08f22008-10-30 17:37:03 +110054
Darrick J. Wongc076ae72021-05-31 11:32:02 -070055void xfs_inode_mark_reclaimable(struct xfs_inode *ip);
Christoph Hellwigfe588ed2009-06-08 15:35:27 +020056
Darrick J. Wongc237dd72021-01-22 16:48:37 -080057int xfs_blockgc_free_dquots(struct xfs_mount *mp, struct xfs_dquot *udqp,
58 struct xfs_dquot *gdqp, struct xfs_dquot *pdqp,
Darrick J. Wong2d53f66b2021-06-07 09:34:51 -070059 unsigned int iwalk_flags);
60int xfs_blockgc_free_quota(struct xfs_inode *ip, unsigned int iwalk_flags);
Darrick J. Wongb26b2bf2021-06-07 09:34:51 -070061int xfs_blockgc_free_space(struct xfs_mount *mp, struct xfs_icwalk *icm);
Darrick J. Wonge8d04c22021-08-06 11:05:42 -070062void xfs_blockgc_flush_all(struct xfs_mount *mp);
Darrick J. Wonga636b1d2021-01-22 16:48:34 -080063
Brian Foster27b52862012-11-06 09:50:38 -050064void xfs_inode_set_eofblocks_tag(struct xfs_inode *ip);
65void xfs_inode_clear_eofblocks_tag(struct xfs_inode *ip);
66
Darrick J. Wong83104d42016-10-03 09:11:46 -070067void xfs_inode_set_cowblocks_tag(struct xfs_inode *ip);
68void xfs_inode_clear_cowblocks_tag(struct xfs_inode *ip);
Darrick J. Wong9669f512021-01-22 16:48:43 -080069
70void xfs_blockgc_worker(struct work_struct *work);
Darrick J. Wong83104d42016-10-03 09:11:46 -070071
Darrick J. Wong378f6812017-06-19 08:58:56 -070072int xfs_icache_inode_is_allocated(struct xfs_mount *mp, struct xfs_trans *tp,
73 xfs_ino_t ino, bool *inuse);
74
Darrick J. Wongc9a65262021-01-22 16:48:44 -080075void xfs_blockgc_stop(struct xfs_mount *mp);
76void xfs_blockgc_start(struct xfs_mount *mp);
Darrick J. Wongd6b636e2018-05-09 10:03:56 -070077
Dave Chinnerab23a772021-08-06 11:05:39 -070078void xfs_inodegc_worker(struct work_struct *work);
79void xfs_inodegc_flush(struct xfs_mount *mp);
80void xfs_inodegc_stop(struct xfs_mount *mp);
81void xfs_inodegc_start(struct xfs_mount *mp);
82void xfs_inodegc_cpu_dead(struct xfs_mount *mp, unsigned int cpu);
Darrick J. Wong40b1de0072021-08-06 11:05:43 -070083int xfs_inodegc_register_shrinker(struct xfs_mount *mp);
Dave Chinnerab23a772021-08-06 11:05:39 -070084
David Chinnerfe4fa4b2008-10-30 17:06:08 +110085#endif