162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * filecheck.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Online file check. 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Copyright (C) 2016 SuSE. All rights reserved. 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#ifndef FILECHECK_H 1262306a36Sopenharmony_ci#define FILECHECK_H 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#include <linux/types.h> 1562306a36Sopenharmony_ci#include <linux/list.h> 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci/* File check errno */ 1962306a36Sopenharmony_cienum { 2062306a36Sopenharmony_ci OCFS2_FILECHECK_ERR_SUCCESS = 0, /* Success */ 2162306a36Sopenharmony_ci OCFS2_FILECHECK_ERR_FAILED = 1000, /* Other failure */ 2262306a36Sopenharmony_ci OCFS2_FILECHECK_ERR_INPROGRESS, /* In progress */ 2362306a36Sopenharmony_ci OCFS2_FILECHECK_ERR_READONLY, /* Read only */ 2462306a36Sopenharmony_ci OCFS2_FILECHECK_ERR_INJBD, /* Buffer in jbd */ 2562306a36Sopenharmony_ci OCFS2_FILECHECK_ERR_INVALIDINO, /* Invalid ino */ 2662306a36Sopenharmony_ci OCFS2_FILECHECK_ERR_BLOCKECC, /* Block ecc */ 2762306a36Sopenharmony_ci OCFS2_FILECHECK_ERR_BLOCKNO, /* Block number */ 2862306a36Sopenharmony_ci OCFS2_FILECHECK_ERR_VALIDFLAG, /* Inode valid flag */ 2962306a36Sopenharmony_ci OCFS2_FILECHECK_ERR_GENERATION, /* Inode generation */ 3062306a36Sopenharmony_ci OCFS2_FILECHECK_ERR_UNSUPPORTED /* Unsupported */ 3162306a36Sopenharmony_ci}; 3262306a36Sopenharmony_ci 3362306a36Sopenharmony_ci#define OCFS2_FILECHECK_ERR_START OCFS2_FILECHECK_ERR_FAILED 3462306a36Sopenharmony_ci#define OCFS2_FILECHECK_ERR_END OCFS2_FILECHECK_ERR_UNSUPPORTED 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_cistruct ocfs2_filecheck { 3762306a36Sopenharmony_ci struct list_head fc_head; /* File check entry list head */ 3862306a36Sopenharmony_ci spinlock_t fc_lock; 3962306a36Sopenharmony_ci unsigned int fc_max; /* Maximum number of entry in list */ 4062306a36Sopenharmony_ci unsigned int fc_size; /* Current entry count in list */ 4162306a36Sopenharmony_ci unsigned int fc_done; /* Finished entry count in list */ 4262306a36Sopenharmony_ci}; 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#define OCFS2_FILECHECK_MAXSIZE 100 4562306a36Sopenharmony_ci#define OCFS2_FILECHECK_MINSIZE 10 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci/* File check operation type */ 4862306a36Sopenharmony_cienum { 4962306a36Sopenharmony_ci OCFS2_FILECHECK_TYPE_CHK = 0, /* Check a file(inode) */ 5062306a36Sopenharmony_ci OCFS2_FILECHECK_TYPE_FIX, /* Fix a file(inode) */ 5162306a36Sopenharmony_ci OCFS2_FILECHECK_TYPE_SET = 100 /* Set entry list maximum size */ 5262306a36Sopenharmony_ci}; 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_cistruct ocfs2_filecheck_sysfs_entry { /* sysfs entry per partition */ 5562306a36Sopenharmony_ci struct kobject fs_kobj; 5662306a36Sopenharmony_ci struct completion fs_kobj_unregister; 5762306a36Sopenharmony_ci struct ocfs2_filecheck *fs_fcheck; 5862306a36Sopenharmony_ci}; 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci 6162306a36Sopenharmony_ciint ocfs2_filecheck_create_sysfs(struct ocfs2_super *osb); 6262306a36Sopenharmony_civoid ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb); 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#endif /* FILECHECK_H */ 65