filecheck.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * filecheck.h
  4. *
  5. * Online file check.
  6. *
  7. * Copyright (C) 2016 SuSE. All rights reserved.
  8. */
  9. #ifndef FILECHECK_H
  10. #define FILECHECK_H
  11. #include <linux/types.h>
  12. #include <linux/list.h>
  13. /* File check errno */
  14. enum {
  15. OCFS2_FILECHECK_ERR_SUCCESS = 0, /* Success */
  16. OCFS2_FILECHECK_ERR_FAILED = 1000, /* Other failure */
  17. OCFS2_FILECHECK_ERR_INPROGRESS, /* In progress */
  18. OCFS2_FILECHECK_ERR_READONLY, /* Read only */
  19. OCFS2_FILECHECK_ERR_INJBD, /* Buffer in jbd */
  20. OCFS2_FILECHECK_ERR_INVALIDINO, /* Invalid ino */
  21. OCFS2_FILECHECK_ERR_BLOCKECC, /* Block ecc */
  22. OCFS2_FILECHECK_ERR_BLOCKNO, /* Block number */
  23. OCFS2_FILECHECK_ERR_VALIDFLAG, /* Inode valid flag */
  24. OCFS2_FILECHECK_ERR_GENERATION, /* Inode generation */
  25. OCFS2_FILECHECK_ERR_UNSUPPORTED /* Unsupported */
  26. };
  27. #define OCFS2_FILECHECK_ERR_START OCFS2_FILECHECK_ERR_FAILED
  28. #define OCFS2_FILECHECK_ERR_END OCFS2_FILECHECK_ERR_UNSUPPORTED
  29. struct ocfs2_filecheck {
  30. struct list_head fc_head; /* File check entry list head */
  31. spinlock_t fc_lock;
  32. unsigned int fc_max; /* Maximum number of entry in list */
  33. unsigned int fc_size; /* Current entry count in list */
  34. unsigned int fc_done; /* Finished entry count in list */
  35. };
  36. #define OCFS2_FILECHECK_MAXSIZE 100
  37. #define OCFS2_FILECHECK_MINSIZE 10
  38. /* File check operation type */
  39. enum {
  40. OCFS2_FILECHECK_TYPE_CHK = 0, /* Check a file(inode) */
  41. OCFS2_FILECHECK_TYPE_FIX, /* Fix a file(inode) */
  42. OCFS2_FILECHECK_TYPE_SET = 100 /* Set entry list maximum size */
  43. };
  44. struct ocfs2_filecheck_sysfs_entry { /* sysfs entry per partition */
  45. struct kobject fs_kobj;
  46. struct completion fs_kobj_unregister;
  47. struct ocfs2_filecheck *fs_fcheck;
  48. };
  49. int ocfs2_filecheck_create_sysfs(struct ocfs2_super *osb);
  50. void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb);
  51. #endif /* FILECHECK_H */