blob: 09dd9af454349b57fe2a8a7bec0f3c5c3c7e4e3e [file] [log] [blame]
David Chinner2a82b8b2007-07-11 11:09:12 +10001/*
2 * Copyright (c) 2006-2007 Silicon Graphics, Inc.
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef __XFS_FILESTREAM_H__
19#define __XFS_FILESTREAM_H__
20
21#ifdef __KERNEL__
22
23struct xfs_mount;
24struct xfs_inode;
25struct xfs_perag;
26struct xfs_bmalloca;
27
28#ifdef XFS_FILESTREAMS_TRACE
29#define XFS_FSTRM_KTRACE_INFO 1
30#define XFS_FSTRM_KTRACE_AGSCAN 2
31#define XFS_FSTRM_KTRACE_AGPICK1 3
32#define XFS_FSTRM_KTRACE_AGPICK2 4
33#define XFS_FSTRM_KTRACE_UPDATE 5
34#define XFS_FSTRM_KTRACE_FREE 6
35#define XFS_FSTRM_KTRACE_ITEM_LOOKUP 7
36#define XFS_FSTRM_KTRACE_ASSOCIATE 8
37#define XFS_FSTRM_KTRACE_MOVEAG 9
38#define XFS_FSTRM_KTRACE_ORPHAN 10
39
40#define XFS_FSTRM_KTRACE_SIZE 16384
41extern ktrace_t *xfs_filestreams_trace_buf;
42
43#endif
44
David Chinner2a82b8b2007-07-11 11:09:12 +100045/* allocation selection flags */
46typedef enum xfs_fstrm_alloc {
47 XFS_PICK_USERDATA = 1,
48 XFS_PICK_LOWSPACE = 2,
49} xfs_fstrm_alloc_t;
50
51/* prototypes for filestream.c */
52int xfs_filestream_init(void);
53void xfs_filestream_uninit(void);
54int xfs_filestream_mount(struct xfs_mount *mp);
55void xfs_filestream_unmount(struct xfs_mount *mp);
David Chinner2a82b8b2007-07-11 11:09:12 +100056xfs_agnumber_t xfs_filestream_lookup_ag(struct xfs_inode *ip);
57int xfs_filestream_associate(struct xfs_inode *dip, struct xfs_inode *ip);
58void xfs_filestream_deassociate(struct xfs_inode *ip);
59int xfs_filestream_new_ag(struct xfs_bmalloca *ap, xfs_agnumber_t *agp);
60
61
62/* filestreams for the inode? */
Christoph Hellwigb8f82a42009-11-14 16:17:22 +000063static inline int
David Chinner2a82b8b2007-07-11 11:09:12 +100064xfs_inode_is_filestream(
65 struct xfs_inode *ip)
66{
67 return (ip->i_mount->m_flags & XFS_MOUNT_FILESTREAMS) ||
68 xfs_iflags_test(ip, XFS_IFILESTREAM) ||
69 (ip->i_d.di_flags & XFS_DIFLAG_FILESTREAM);
70}
71
72#endif /* __KERNEL__ */
73
74#endif /* __XFS_FILESTREAM_H__ */