xref: /linux/fs/ocfs2/filecheck.h (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
150acfb2bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2*fa60ce2cSMasahiro Yamada /*
3a860f6ebSGang He  * filecheck.h
4a860f6ebSGang He  *
5a860f6ebSGang He  * Online file check.
6a860f6ebSGang He  *
7a860f6ebSGang He  * Copyright (C) 2016 SuSE.  All rights reserved.
8a860f6ebSGang He  */
9a860f6ebSGang He 
10a860f6ebSGang He 
11a860f6ebSGang He #ifndef FILECHECK_H
12a860f6ebSGang He #define FILECHECK_H
13a860f6ebSGang He 
14a860f6ebSGang He #include <linux/types.h>
15a860f6ebSGang He #include <linux/list.h>
16a860f6ebSGang He 
17a860f6ebSGang He 
18a860f6ebSGang He /* File check errno */
19a860f6ebSGang He enum {
20a860f6ebSGang He 	OCFS2_FILECHECK_ERR_SUCCESS = 0,	/* Success */
21a860f6ebSGang He 	OCFS2_FILECHECK_ERR_FAILED = 1000,	/* Other failure */
22a860f6ebSGang He 	OCFS2_FILECHECK_ERR_INPROGRESS,		/* In progress */
23a860f6ebSGang He 	OCFS2_FILECHECK_ERR_READONLY,		/* Read only */
24a860f6ebSGang He 	OCFS2_FILECHECK_ERR_INJBD,		/* Buffer in jbd */
25a860f6ebSGang He 	OCFS2_FILECHECK_ERR_INVALIDINO,		/* Invalid ino */
26a860f6ebSGang He 	OCFS2_FILECHECK_ERR_BLOCKECC,		/* Block ecc */
27a860f6ebSGang He 	OCFS2_FILECHECK_ERR_BLOCKNO,		/* Block number */
28a860f6ebSGang He 	OCFS2_FILECHECK_ERR_VALIDFLAG,		/* Inode valid flag */
29a860f6ebSGang He 	OCFS2_FILECHECK_ERR_GENERATION,		/* Inode generation */
30a860f6ebSGang He 	OCFS2_FILECHECK_ERR_UNSUPPORTED		/* Unsupported */
31a860f6ebSGang He };
32a860f6ebSGang He 
33a860f6ebSGang He #define OCFS2_FILECHECK_ERR_START	OCFS2_FILECHECK_ERR_FAILED
34a860f6ebSGang He #define OCFS2_FILECHECK_ERR_END		OCFS2_FILECHECK_ERR_UNSUPPORTED
35a860f6ebSGang He 
365ac94386SGang He struct ocfs2_filecheck {
375ac94386SGang He 	struct list_head fc_head;	/* File check entry list head */
385ac94386SGang He 	spinlock_t fc_lock;
395ac94386SGang He 	unsigned int fc_max;	/* Maximum number of entry in list */
405ac94386SGang He 	unsigned int fc_size;	/* Current entry count in list */
415ac94386SGang He 	unsigned int fc_done;	/* Finished entry count in list */
425ac94386SGang He };
435ac94386SGang He 
445ac94386SGang He #define OCFS2_FILECHECK_MAXSIZE		100
455ac94386SGang He #define OCFS2_FILECHECK_MINSIZE		10
465ac94386SGang He 
475ac94386SGang He /* File check operation type */
485ac94386SGang He enum {
495ac94386SGang He 	OCFS2_FILECHECK_TYPE_CHK = 0,	/* Check a file(inode) */
505ac94386SGang He 	OCFS2_FILECHECK_TYPE_FIX,	/* Fix a file(inode) */
515ac94386SGang He 	OCFS2_FILECHECK_TYPE_SET = 100	/* Set entry list maximum size */
525ac94386SGang He };
535ac94386SGang He 
545f483c4aSGang He struct ocfs2_filecheck_sysfs_entry {	/* sysfs entry per partition */
555f483c4aSGang He 	struct kobject fs_kobj;
565f483c4aSGang He 	struct completion fs_kobj_unregister;
575f483c4aSGang He 	struct ocfs2_filecheck *fs_fcheck;
585f483c4aSGang He };
595f483c4aSGang He 
605f483c4aSGang He 
615f483c4aSGang He int ocfs2_filecheck_create_sysfs(struct ocfs2_super *osb);
625f483c4aSGang He void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb);
63a860f6ebSGang He 
64a860f6ebSGang He #endif  /* FILECHECK_H */
65