From: Hugang <hugang@soulinfo.com>
To: Nikita Danilov <Nikita@Namesys.COM>
Cc: Bart Samwel <bart@samwel.tk>,
linux-kernel@vger.kernel.org, Jens Axboe <axboe@suse.de>
Subject: Re: [PATCH] laptop-mode for 2.6, version 2
Date: Thu, 25 Dec 2003 10:59:16 +0800 [thread overview]
Message-ID: <20031225105916.67e74599.hugang@soulinfo.com> (raw)
In-Reply-To: <16361.41348.444243.919179@laputa.namesys.com>
[-- Attachment #1: Type: text/plain, Size: 557 bytes --]
On Wed, 24 Dec 2003 17:24:04 +0300
Nikita Danilov <Nikita@Namesys.COM> wrote:
> +int reiserfs_default_max_commit_age = -1;
> +
>
> I am not sure that global variable is a good idea here. What if several
> file systems are mounted? You should either pass value as an argument to
> the journal initialization code, or just initialize
> SB_JOURNAL_MAX_COMMIT_AGE(sb) when parsing options.
this patch do it, pls check.
thanks.
--
Hu Gang / Steve
RLU# : 204016 [1999] (Registered Linux user)
GPG Public Key: http://soulinfo.com/~hugang/HuGang.asc
[-- Attachment #2: reiserfs_laptop_mode --]
[-- Type: application/octet-stream, Size: 5479 bytes --]
Index: linux-2.6.0/include/linux/reiserfs_fs.h
===================================================================
--- linux-2.6.0/include/linux/reiserfs_fs.h (revision 94)
+++ linux-2.6.0/include/linux/reiserfs_fs.h (working copy)
@@ -1719,7 +1719,7 @@
void reiserfs_check_lock_depth(char *caller) ;
void reiserfs_prepare_for_journal(struct super_block *, struct buffer_head *bh, int wait) ;
void reiserfs_restore_prepared_buffer(struct super_block *, struct buffer_head *bh) ;
-int journal_init(struct super_block *, const char * j_dev_name, int old_format) ;
+int journal_init(struct super_block *, const char * j_dev_name, int old_format, unsigned int) ;
int journal_release(struct reiserfs_transaction_handle*, struct super_block *) ;
int journal_release_error(struct reiserfs_transaction_handle*, struct super_block *) ;
int journal_end(struct reiserfs_transaction_handle *, struct super_block *, unsigned long) ;
Index: linux-2.6.0/fs/reiserfs/super.c
===================================================================
--- linux-2.6.0/fs/reiserfs/super.c (revision 94)
+++ linux-2.6.0/fs/reiserfs/super.c (working copy)
@@ -645,7 +645,8 @@
collection of bitflags defining what
mount options were selected. */
unsigned long * blocks, /* strtol-ed from NNN of resize=NNN */
- char ** jdev_name)
+ char ** jdev_name,
+ unsigned int * commit_max_age)
{
int c;
char * arg = NULL;
@@ -662,6 +663,7 @@
{"resize", 'r', 0, 0, 0},
{"jdev", 'j', 0, 0, 0},
{"nolargeio", 'w', 0, 0, 0},
+ {"commit", 'c', 0, 0, 0},
{NULL, 0, 0, 0, 0}
};
@@ -690,6 +692,19 @@
}
}
+ if ( c == 'c' ) {
+ char *p = 0;
+ int val = simple_strtoul (arg, &p, 0);
+
+ if ( *p != '\0') {
+ printk ("reiserfs_parse_options: bad value %s\n", arg);
+ return 0;
+ }
+ if ( val ) {
+ *commit_max_age = val;
+ }
+ }
+
if ( c == 'w' ) {
char *p=0;
int val = simple_strtoul (arg, &p, 0);
@@ -743,10 +758,11 @@
unsigned long blocks;
unsigned long mount_options = REISERFS_SB(s)->s_mount_opt;
unsigned long safe_mask = 0;
+ unsigned int commit_max_age = -1;
rs = SB_DISK_SUPER_BLOCK (s);
- if (!reiserfs_parse_options(s, arg, &mount_options, &blocks, NULL))
+ if (!reiserfs_parse_options(s, arg, &mount_options, &blocks, NULL, &commit_max_age))
return -EINVAL;
handle_attrs(s);
@@ -764,6 +780,10 @@
* the bits we're not allowed to change here */
REISERFS_SB(s)->s_mount_opt = (REISERFS_SB(s)->s_mount_opt & ~safe_mask) | (mount_options & safe_mask);
+ if(commit_max_age != -1) {
+ SB_JOURNAL_MAX_COMMIT_AGE(s) = commit_max_age;
+ }
+
if(blocks) {
int rc = reiserfs_resize(s, blocks);
if (rc != 0)
@@ -1213,6 +1233,7 @@
struct reiserfs_transaction_handle th ;
int old_format = 0;
unsigned long blocks;
+ unsigned int commit_max_age = -1;
int jinit_done = 0 ;
struct reiserfs_iget_args args ;
struct reiserfs_super_block * rs;
@@ -1237,7 +1258,7 @@
REISERFS_SB(s)->s_alloc_options.preallocsize = 9;
jdev_name = NULL;
- if (reiserfs_parse_options (s, (char *) data, &(sbi->s_mount_opt), &blocks, &jdev_name) == 0) {
+ if (reiserfs_parse_options (s, (char *) data, &(sbi->s_mount_opt), &blocks, &jdev_name, &commit_max_age) == 0) {
goto error;
}
@@ -1279,7 +1300,7 @@
#endif
// set_device_ro(s->s_dev, 1) ;
- if( journal_init(s, jdev_name, old_format) ) {
+ if( journal_init(s, jdev_name, old_format, commit_max_age) ) {
printk("sh-2022: reiserfs_fill_super: unable to initialize journal space\n") ;
goto error ;
} else {
Index: linux-2.6.0/fs/reiserfs/journal.c
===================================================================
--- linux-2.6.0/fs/reiserfs/journal.c (revision 94)
+++ linux-2.6.0/fs/reiserfs/journal.c (working copy)
@@ -1967,7 +1967,7 @@
/*
** must be called once on fs mount. calls journal_read for you
*/
-int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_format) {
+int journal_init(struct super_block *p_s_sb, const char * j_dev_name, int old_format, unsigned int commit_max_age) {
int num_cnodes = SB_ONDISK_JOURNAL_SIZE(p_s_sb) * 2 ;
struct buffer_head *bhjh;
struct reiserfs_super_block * rs;
@@ -2032,7 +2032,11 @@
SB_JOURNAL_TRANS_MAX(p_s_sb) = le32_to_cpu (jh->jh_journal.jp_journal_trans_max);
SB_JOURNAL_MAX_BATCH(p_s_sb) = le32_to_cpu (jh->jh_journal.jp_journal_max_batch);
- SB_JOURNAL_MAX_COMMIT_AGE(p_s_sb) = le32_to_cpu (jh->jh_journal.jp_journal_max_commit_age);
+ if (commit_max_age != -1) {
+ SB_JOURNAL_MAX_COMMIT_AGE(p_s_sb) = commit_max_age;
+ } else {
+ SB_JOURNAL_MAX_COMMIT_AGE(p_s_sb) = le32_to_cpu (jh->jh_journal.jp_journal_max_commit_age);
+ }
SB_JOURNAL_MAX_TRANS_AGE(p_s_sb) = JOURNAL_MAX_TRANS_AGE;
if (SB_JOURNAL_TRANS_MAX(p_s_sb)) {
Index: linux-2.6.0/fs/reiserfs/procfs.c
===================================================================
--- linux-2.6.0/fs/reiserfs/procfs.c (revision 94)
+++ linux-2.6.0/fs/reiserfs/procfs.c (working copy)
@@ -401,7 +401,7 @@
DJP( jp_journal_trans_max ),
DJP( jp_journal_magic ),
DJP( jp_journal_max_batch ),
- DJP( jp_journal_max_commit_age ),
+ SB_JOURNAL_MAX_COMMIT_AGE(sb),
DJP( jp_journal_max_trans_age ),
JF( j_1st_reserved_block ),
next prev parent reply other threads:[~2003-12-25 3:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-24 5:33 Bart Samwel
2003-12-24 11:16 ` Jens Axboe
2003-12-24 15:25 ` [PATCH] laptop-mode for 2.6, version 3 Bart Samwel
2003-12-25 10:06 ` Arnaldo Carvalho de Melo
2003-12-25 15:12 ` [PATCH] laptop-mode for 2.6, version 4 + smart_spindown Bart Samwel
2003-12-25 17:04 ` John Bradford
2003-12-25 21:39 ` Bart Samwel
2003-12-27 10:57 ` A couple of questions about laptop-mode for 2.6, version 4 Kiko Piris
2003-12-24 13:51 ` [PATCH] laptop-mode for 2.6, version 2 Hugang
2003-12-24 14:24 ` Nikita Danilov
2003-12-25 2:59 ` Hugang [this message]
[not found] ` <16362.43831.569086.825899@laputa.namesys.com>
2003-12-25 9:40 ` Hugang
2003-12-25 10:27 ` Nikita Danilov
2003-12-25 10:59 ` Hugang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031225105916.67e74599.hugang@soulinfo.com \
--to=hugang@soulinfo.com \
--cc=Nikita@Namesys.COM \
--cc=axboe@suse.de \
--cc=bart@samwel.tk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®