On Fri, 02 Feb 2007 13:50:10 -1000<snipped>
akuster@xxxxxxxxxx wrote:
ok.+struct suspremount {
+struct super_block *sb;
+struct suspremount *next;
+};
The fields of this struct need a leading tab.
ok.
The name "suspremount" might be unpopular. suspend_remount_state would be
more kernely.
+static struct suspremount *suspremount_list;
+
+void suspend_remount_log_fs(struct super_block *sb)
+{
+ struct suspremount *remountp;
+
+ if ((remountp = (struct suspremount *)
+ kmalloc(sizeof(struct suspremount), GFP_KERNEL)) != NULL) {
The typecast is unneeded, and the compounded assign-and-test is not
preferred style. So here, please use
struct suspremount *remountp;
remountp = kmalloc(sizeof(*remountp), GFP_KERNEL);
if (remountp != NULL) {
it shouldn't. will remove+EXPORT_SYMBOL(suspend_remount_all_fs_ro);
Why is this exported to modules?
+ sb = remountp->sb;
+ flags = 0;
+ if (sb->s_op && sb->s_op->remount_fs) {
+ ret = sb->s_op->remount_fs(sb, &flags, NULL);
+ if (ret) printk("resume_remount_rw: error %d\n", ret);
newline needed here.
super_block_operations.remount_fs() is supposed to be called under lock_super().
Some filesystems might go BUG over this, or something. Was there a reason to
not do this?
+ }
+
+ tp = remountp->next;
+ kfree(remountp);
+ remountp = tp;
+ }
+ suspremount_list = NULL;
+}
+EXPORT_SYMBOL(resume_remount_fs_rw);
Why the export?
All this code is singly-threaded at a much higher level (I hope), hence
that list doesn't need locking. However a comment explaining this might be
good.
will do.
@@ -613,6 +677,9 @@ int do_remount_sb(struct super_block *sb
unlock_super(sb);
if (retval)
return retval;
+#ifdef CONFIG_SUSPEND_REMOUNTFS
+ suspend_remount_log_fs(sb);
+#endif
We try to avoid putting ifdefs in C files. So in a header file, do
struct super_block;
#ifdef CONFIG_SUSPEND_REMOUNTFS
extern void suspend_remount_log_fs(struct super_block *sb);
#else
static inline void suspend_remount_log_fs(struct super_block *sb) {}
#endif