2019-05-29 14:18:00 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2016-03-22 21:24:24 +00:00
|
|
|
/* -*- mode: c; c-basic-offset: 8; -*-
|
|
|
|
* vim: noexpandtab sw=8 ts=8 sts=0:
|
|
|
|
*
|
|
|
|
* filecheck.h
|
|
|
|
*
|
|
|
|
* Online file check.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016 SuSE. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef FILECHECK_H
|
|
|
|
#define FILECHECK_H
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
|
|
|
|
|
|
|
|
/* File check errno */
|
|
|
|
enum {
|
|
|
|
OCFS2_FILECHECK_ERR_SUCCESS = 0, /* Success */
|
|
|
|
OCFS2_FILECHECK_ERR_FAILED = 1000, /* Other failure */
|
|
|
|
OCFS2_FILECHECK_ERR_INPROGRESS, /* In progress */
|
|
|
|
OCFS2_FILECHECK_ERR_READONLY, /* Read only */
|
|
|
|
OCFS2_FILECHECK_ERR_INJBD, /* Buffer in jbd */
|
|
|
|
OCFS2_FILECHECK_ERR_INVALIDINO, /* Invalid ino */
|
|
|
|
OCFS2_FILECHECK_ERR_BLOCKECC, /* Block ecc */
|
|
|
|
OCFS2_FILECHECK_ERR_BLOCKNO, /* Block number */
|
|
|
|
OCFS2_FILECHECK_ERR_VALIDFLAG, /* Inode valid flag */
|
|
|
|
OCFS2_FILECHECK_ERR_GENERATION, /* Inode generation */
|
|
|
|
OCFS2_FILECHECK_ERR_UNSUPPORTED /* Unsupported */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OCFS2_FILECHECK_ERR_START OCFS2_FILECHECK_ERR_FAILED
|
|
|
|
#define OCFS2_FILECHECK_ERR_END OCFS2_FILECHECK_ERR_UNSUPPORTED
|
|
|
|
|
ocfs2: move some definitions to header file
Patch series "ocfs2: use kobject for online file check", v3.
Use embedded kobject mechanism for online file check feature, this will
avoid to use a global list to save/search per-device online file check
related data. The changed code is based on Goldwyn Rodrigues's patches
and ext4 fs code, there is not any new features added, except some very
small fixes during this code refactoring. Second, the code change does
not affect the underlying file check code. Thank Goldwyn very much.
Compare with second version, add more comments in the patch
descriptions, to make sure each modification is mentioned. Compare with
first version, split the code change into four patches, make sure each
patch will not bring ocfs2 kernel modules compiling errors.
This patch (of 3):
Move some definitions to header file, which will be referenced by other
source files when kobject mechanism is introduced.
Link: http://lkml.kernel.org/r/1495611866-27360-2-git-send-email-ghe@suse.com
Signed-off-by: Gang He <ghe@suse.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-04-05 23:19:22 +00:00
|
|
|
struct ocfs2_filecheck {
|
|
|
|
struct list_head fc_head; /* File check entry list head */
|
|
|
|
spinlock_t fc_lock;
|
|
|
|
unsigned int fc_max; /* Maximum number of entry in list */
|
|
|
|
unsigned int fc_size; /* Current entry count in list */
|
|
|
|
unsigned int fc_done; /* Finished entry count in list */
|
|
|
|
};
|
|
|
|
|
|
|
|
#define OCFS2_FILECHECK_MAXSIZE 100
|
|
|
|
#define OCFS2_FILECHECK_MINSIZE 10
|
|
|
|
|
|
|
|
/* File check operation type */
|
|
|
|
enum {
|
|
|
|
OCFS2_FILECHECK_TYPE_CHK = 0, /* Check a file(inode) */
|
|
|
|
OCFS2_FILECHECK_TYPE_FIX, /* Fix a file(inode) */
|
|
|
|
OCFS2_FILECHECK_TYPE_SET = 100 /* Set entry list maximum size */
|
|
|
|
};
|
|
|
|
|
2018-04-05 23:19:29 +00:00
|
|
|
struct ocfs2_filecheck_sysfs_entry { /* sysfs entry per partition */
|
|
|
|
struct kobject fs_kobj;
|
|
|
|
struct completion fs_kobj_unregister;
|
|
|
|
struct ocfs2_filecheck *fs_fcheck;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
int ocfs2_filecheck_create_sysfs(struct ocfs2_super *osb);
|
|
|
|
void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb);
|
2016-03-22 21:24:24 +00:00
|
|
|
|
|
|
|
#endif /* FILECHECK_H */
|