diff mbox

[v2] Btrfs: clear compress-force when remounting with compress option

Message ID 1404096685-10591-1-git-send-email-wangsl.fnst@cn.fujitsu.com (mailing list archive)
State Accepted
Headers show

Commit Message

Wang Shilong June 30, 2014, 2:51 a.m. UTC
Steps to reproduce:
 # mkfs.btrfs -f /dev/sdb
 # mount /dev/sdb /mnt -o compress-force=lzo
 # mount /dev/sdb /mnt -o remount,compress=zlib
 # cat /proc/mounts

Remounting from compress-force to compress could not clear compress-force
option. The problem is there is no way for users to clear compress-force
option separately.

Fix this problem by clearing @FORCE_COMPRESS flag when remounting to
compress=xxx.

Suggested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
---
v1->v2: remove unnecessary message output which was addressed
        by David.
---
 fs/btrfs/super.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

David Sterba July 1, 2014, 4:04 p.m. UTC | #1
On Mon, Jun 30, 2014 at 10:51:25AM +0800, Wang Shilong wrote:
> Steps to reproduce:
>  # mkfs.btrfs -f /dev/sdb
>  # mount /dev/sdb /mnt -o compress-force=lzo
>  # mount /dev/sdb /mnt -o remount,compress=zlib
>  # cat /proc/mounts
> 
> Remounting from compress-force to compress could not clear compress-force
> option. The problem is there is no way for users to clear compress-force
> option separately.
> 
> Fix this problem by clearing @FORCE_COMPRESS flag when remounting to
> compress=xxx.
> 
> Suggested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>

I'm sorry for lack of answer in the V1 thread, V2 is the minimal bugfix
and I'm fine with it right away.

Reviewed-by: David Sterba <dsterba@suse.cz>
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Satoru Takeuchi July 2, 2014, 1:58 a.m. UTC | #2
(2014/07/02 1:04), David Sterba wrote:
> On Mon, Jun 30, 2014 at 10:51:25AM +0800, Wang Shilong wrote:
>> Steps to reproduce:
>>   # mkfs.btrfs -f /dev/sdb
>>   # mount /dev/sdb /mnt -o compress-force=lzo
>>   # mount /dev/sdb /mnt -o remount,compress=zlib
>>   # cat /proc/mounts
>>
>> Remounting from compress-force to compress could not clear compress-force
>> option. The problem is there is no way for users to clear compress-force
>> option separately.
>>
>> Fix this problem by clearing @FORCE_COMPRESS flag when remounting to
>> compress=xxx.
>>
>> Suggested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
>> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
>
> I'm sorry for lack of answer in the V1 thread, V2 is the minimal bugfix
> and I'm fine with it right away.
>
> Reviewed-by: David Sterba <dsterba@suse.cz>

Test result (I used your reproducer):
   3.16-rc3:               FAIL
   3.16-rc3 w/ your patch: PASS

Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

Thanks,
Satoru

> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Wang Shilong July 2, 2014, 2:21 a.m. UTC | #3
On 07/02/2014 09:58 AM, Satoru Takeuchi wrote:
> (2014/07/02 1:04), David Sterba wrote:
>> On Mon, Jun 30, 2014 at 10:51:25AM +0800, Wang Shilong wrote:
>>> Steps to reproduce:
>>>   # mkfs.btrfs -f /dev/sdb
>>>   # mount /dev/sdb /mnt -o compress-force=lzo
>>>   # mount /dev/sdb /mnt -o remount,compress=zlib
>>>   # cat /proc/mounts
>>>
>>> Remounting from compress-force to compress could not clear 
>>> compress-force
>>> option. The problem is there is no way for users to clear 
>>> compress-force
>>> option separately.
>>>
>>> Fix this problem by clearing @FORCE_COMPRESS flag when remounting to
>>> compress=xxx.
>>>
>>> Suggested-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com>
>>> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
>>
>> I'm sorry for lack of answer in the V1 thread, V2 is the minimal bugfix
>> and I'm fine with it right away.
>>
>> Reviewed-by: David Sterba <dsterba@suse.cz>
>
> Test result (I used your reproducer):
>   3.16-rc3:               FAIL
>   3.16-rc3 w/ your patch: PASS
>
> Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
> Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>

Satoru, Thanks for doing this. ^_^

Regards,
Wang
>
> Thanks,
> Satoru
>
>> -- 
>> To unsubscribe from this list: send the line "unsubscribe 
>> linux-btrfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
> .
>

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 4662d92..5aae8f0 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -513,6 +513,13 @@  int btrfs_parse_options(struct btrfs_root *root, char *options)
 					btrfs_info(root->fs_info,
 						   "btrfs: use %s compression",
 						   compress_type);
+				/*
+				 * If we remount from compress-force=xxx to
+				 * compress=xxx, we need clear FORCE_COMPRESS
+				 * flag, otherwise, there is no way for users
+				 * to disable forcible compression separately.
+				 */
+				btrfs_clear_opt(info->mount_opt, FORCE_COMPRESS);
 			}
 			break;
 		case Opt_ssd: