diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-11-01 08:57:49 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2008-12-03 06:14:05 -0500 |
commit | 553dea4dd531562688ba01c641c7f8fc7abaaf8c (patch) | |
tree | 823d2cb0b8684e7975ca3193a9fec2a53e3995b1 /fs/ubifs/sb.c | |
parent | a1dc080c27ec8ea7ca1c8a9b499362a71ebff792 (diff) |
UBIFS: introduce compression mount options
It is very handy to be able to change default UBIFS compressor
via mount options. Introduce -o compr=<name> mount option support.
Currently only "none", "lzo" and "zlib" compressors are supported.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/sb.c')
-rw-r--r-- | fs/ubifs/sb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index 0f392351dc5a..c5da201ab54f 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c | |||
@@ -179,8 +179,11 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
179 | sup->fanout = cpu_to_le32(DEFAULT_FANOUT); | 179 | sup->fanout = cpu_to_le32(DEFAULT_FANOUT); |
180 | sup->lsave_cnt = cpu_to_le32(c->lsave_cnt); | 180 | sup->lsave_cnt = cpu_to_le32(c->lsave_cnt); |
181 | sup->fmt_version = cpu_to_le32(UBIFS_FORMAT_VERSION); | 181 | sup->fmt_version = cpu_to_le32(UBIFS_FORMAT_VERSION); |
182 | sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO); | ||
183 | sup->time_gran = cpu_to_le32(DEFAULT_TIME_GRAN); | 182 | sup->time_gran = cpu_to_le32(DEFAULT_TIME_GRAN); |
183 | if (c->mount_opts.override_compr) | ||
184 | sup->default_compr = cpu_to_le16(c->mount_opts.compr_type); | ||
185 | else | ||
186 | sup->default_compr = cpu_to_le16(UBIFS_COMPR_LZO); | ||
184 | 187 | ||
185 | generate_random_uuid(sup->uuid); | 188 | generate_random_uuid(sup->uuid); |
186 | 189 | ||
@@ -582,16 +585,15 @@ int ubifs_read_superblock(struct ubifs_info *c) | |||
582 | c->jhead_cnt = le32_to_cpu(sup->jhead_cnt) + NONDATA_JHEADS_CNT; | 585 | c->jhead_cnt = le32_to_cpu(sup->jhead_cnt) + NONDATA_JHEADS_CNT; |
583 | c->fanout = le32_to_cpu(sup->fanout); | 586 | c->fanout = le32_to_cpu(sup->fanout); |
584 | c->lsave_cnt = le32_to_cpu(sup->lsave_cnt); | 587 | c->lsave_cnt = le32_to_cpu(sup->lsave_cnt); |
585 | c->default_compr = le16_to_cpu(sup->default_compr); | ||
586 | c->rp_size = le64_to_cpu(sup->rp_size); | 588 | c->rp_size = le64_to_cpu(sup->rp_size); |
587 | c->rp_uid = le32_to_cpu(sup->rp_uid); | 589 | c->rp_uid = le32_to_cpu(sup->rp_uid); |
588 | c->rp_gid = le32_to_cpu(sup->rp_gid); | 590 | c->rp_gid = le32_to_cpu(sup->rp_gid); |
589 | sup_flags = le32_to_cpu(sup->flags); | 591 | sup_flags = le32_to_cpu(sup->flags); |
592 | if (!c->mount_opts.override_compr) | ||
593 | c->default_compr = le16_to_cpu(sup->default_compr); | ||
590 | 594 | ||
591 | c->vfs_sb->s_time_gran = le32_to_cpu(sup->time_gran); | 595 | c->vfs_sb->s_time_gran = le32_to_cpu(sup->time_gran); |
592 | |||
593 | memcpy(&c->uuid, &sup->uuid, 16); | 596 | memcpy(&c->uuid, &sup->uuid, 16); |
594 | |||
595 | c->big_lpt = !!(sup_flags & UBIFS_FLG_BIGLPT); | 597 | c->big_lpt = !!(sup_flags & UBIFS_FLG_BIGLPT); |
596 | 598 | ||
597 | /* Automatically increase file system size to the maximum size */ | 599 | /* Automatically increase file system size to the maximum size */ |