Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1649201 > unrolled thread

[PATCH v3 0/4] ocfs2: use kobject for online file check

Started byGang He <ghe@suse.com>
First post2017-05-24 09:50 +0200
Last post2017-05-24 09:50 +0200
Articles 3 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 0/4] ocfs2: use kobject for online file check Gang He <ghe@suse.com> - 2017-05-24 09:50 +0200
    [PATCH v3 4/4] ocfs2: add duplicative ino number check Gang He <ghe@suse.com> - 2017-05-24 09:50 +0200
    [PATCH v3 1/4] ocfs2: move some definitions to header file Gang He <ghe@suse.com> - 2017-05-24 09:50 +0200

#1649201 — [PATCH v3 0/4] ocfs2: use kobject for online file check

FromGang He <ghe@suse.com>
Date2017-05-24 09:50 +0200
Subject[PATCH v3 0/4] ocfs2: use kobject for online file check
Message-ID<tKzdo-7Km-7@gated-at.bofh.it>
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.


Gang He (4):
  ocfs2: move some definitions to header file
  ocfs2: fix some small problems
  ocfs2: add kobject for online file check
  ocfs2: add duplicative ino number check

 fs/ocfs2/filecheck.c | 357 ++++++++++++++++++++-------------------------------
 fs/ocfs2/filecheck.h |  29 ++++-
 fs/ocfs2/ocfs2.h     |   8 ++
 fs/ocfs2/super.c     |  27 +++-
 4 files changed, 194 insertions(+), 227 deletions(-)

-- 
1.8.5.6

[toc] | [next] | [standalone]


#1649202 — [PATCH v3 4/4] ocfs2: add duplicative ino number check

FromGang He <ghe@suse.com>
Date2017-05-24 09:50 +0200
Subject[PATCH v3 4/4] ocfs2: add duplicative ino number check
Message-ID<tKzdp-7Km-25@gated-at.bofh.it>
In reply to#1649201
Add duplicative ino number check, to avoid adding a file into the
file check list when this file is being checked.

Signed-off-by: Gang He <ghe@suse.com>
---
 fs/ocfs2/filecheck.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/filecheck.c b/fs/ocfs2/filecheck.c
index a94c531..f65f2b2 100644
--- a/fs/ocfs2/filecheck.c
+++ b/fs/ocfs2/filecheck.c
@@ -354,6 +354,22 @@ static ssize_t ocfs2_filecheck_attr_show(struct kobject *kobj,
 }
 
 static inline int
+ocfs2_filecheck_is_dup_entry(struct ocfs2_filecheck_sysfs_entry *ent,
+				unsigned long ino)
+{
+	struct ocfs2_filecheck_entry *p;
+
+	list_for_each_entry(p, &ent->fs_fcheck->fc_head, fe_list) {
+		if (!p->fe_done) {
+			if (p->fe_ino == ino)
+				return 1;
+		}
+	}
+
+	return 0;
+}
+
+static inline int
 ocfs2_filecheck_erase_entry(struct ocfs2_filecheck_sysfs_entry *ent)
 {
 	struct ocfs2_filecheck_entry *p;
@@ -467,7 +483,10 @@ static ssize_t ocfs2_filecheck_attr_store(struct kobject *kobj,
 	}
 
 	spin_lock(&ent->fs_fcheck->fc_lock);
-	if ((ent->fs_fcheck->fc_size >= ent->fs_fcheck->fc_max) &&
+	if (ocfs2_filecheck_is_dup_entry(ent, args.fa_ino)) {
+		ret = -EEXIST;
+		kfree(entry);
+	} else if ((ent->fs_fcheck->fc_size >= ent->fs_fcheck->fc_max) &&
 		(ent->fs_fcheck->fc_done == 0)) {
 		mlog(ML_NOTICE,
 		"Cannot do more file check "
-- 
1.8.5.6

[toc] | [prev] | [next] | [standalone]


#1649203 — [PATCH v3 1/4] ocfs2: move some definitions to header file

FromGang He <ghe@suse.com>
Date2017-05-24 09:50 +0200
Subject[PATCH v3 1/4] ocfs2: move some definitions to header file
Message-ID<tKzdp-7Km-27@gated-at.bofh.it>
In reply to#1649201
Move some definitions to header file, which will be referenced
by other source files when kobject mechanism is introduced.

Signed-off-by: Gang He <ghe@suse.com>
---
 fs/ocfs2/filecheck.c | 27 ---------------------------
 fs/ocfs2/filecheck.h | 27 +++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/fs/ocfs2/filecheck.c b/fs/ocfs2/filecheck.c
index 2cabbcf..cc7b595 100644
--- a/fs/ocfs2/filecheck.c
+++ b/fs/ocfs2/filecheck.c
@@ -56,33 +56,6 @@
 static DEFINE_SPINLOCK(ocfs2_filecheck_sysfs_lock);
 static LIST_HEAD(ocfs2_filecheck_sysfs_list);
 
-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 */
-};
-
-struct ocfs2_filecheck_sysfs_entry {	/* sysfs entry per mounting */
-	struct list_head fs_list;
-	atomic_t fs_count;
-	struct super_block *fs_sb;
-	struct kset *fs_devicekset;
-	struct kset *fs_fcheckkset;
-	struct ocfs2_filecheck *fs_fcheck;
-};
-
-#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 */
-};
-
 struct ocfs2_filecheck_entry {
 	struct list_head fe_list;
 	unsigned long fe_ino;
diff --git a/fs/ocfs2/filecheck.h b/fs/ocfs2/filecheck.h
index e5cd002..af1678b 100644
--- a/fs/ocfs2/filecheck.h
+++ b/fs/ocfs2/filecheck.h
@@ -43,6 +43,33 @@ enum {
 #define OCFS2_FILECHECK_ERR_START	OCFS2_FILECHECK_ERR_FAILED
 #define OCFS2_FILECHECK_ERR_END		OCFS2_FILECHECK_ERR_UNSUPPORTED
 
+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 */
+};
+
+struct ocfs2_filecheck_sysfs_entry {	/* sysfs entry per mounting */
+	struct list_head fs_list;
+	atomic_t fs_count;
+	struct super_block *fs_sb;
+	struct kset *fs_devicekset;
+	struct kset *fs_fcheckkset;
+	struct ocfs2_filecheck *fs_fcheck;
+};
+
+#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 */
+};
+
 int ocfs2_filecheck_create_sysfs(struct super_block *sb);
 int ocfs2_filecheck_remove_sysfs(struct super_block *sb);
 
-- 
1.8.5.6

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web