diff mbox

ceph: fix alignment of rasize

Message ID 20180530021311.25869-1-cgxu519@gmx.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chengguang Xu May 30, 2018, 2:13 a.m. UTC
Fix improper rasize alignment.

Based on code, rasize(max readahead) actually aligns to PAGESIZE not
1024 which is documented in below link, should fix the document as well.

docs.ceph.com/docs/master/man/8/mount.ceph/

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 fs/ceph/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Yan, Zheng May 30, 2018, 2:16 a.m. UTC | #1
> On May 30, 2018, at 10:13, Chengguang Xu <cgxu519@gmx.com> wrote:
> 
> Fix improper rasize alignment.
> 
> Based on code, rasize(max readahead) actually aligns to PAGESIZE not
> 1024 which is documented in below link, should fix the document as well.
> 
> docs.ceph.com/docs/master/man/8/mount.ceph/
> 
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> ---
> fs/ceph/super.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> index b33082e6878f..465861959a6b 100644
> --- a/fs/ceph/super.c
> +++ b/fs/ceph/super.c
> @@ -268,7 +268,7 @@ static int parse_fsopt_token(char *c, void *private)
> 	case Opt_rasize:
> 		if (intval < 0)
> 			return -EINVAL;
> -		fsopt->rasize = ALIGN(intval + PAGE_SIZE - 1, PAGE_SIZE);
> +		fsopt->rasize = ALIGN(intval, PAGE_SIZE);

if intval is 2048, ALIGN(intval, PAGE_SIZE) is 0.  why do you want to make this change?

> 		break;
> 	case Opt_caps_wanted_delay_min:
> 		if (intval < 1)
> -- 
> 2.17.0
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chengguang Xu May 30, 2018, 2:45 a.m. UTC | #2
> 在 2018年5月30日,上午10:16,Yan, Zheng <zyan@redhat.com> 写道:
> 
> 
> 
>> On May 30, 2018, at 10:13, Chengguang Xu <cgxu519@gmx.com> wrote:
>> 
>> Fix improper rasize alignment.
>> 
>> Based on code, rasize(max readahead) actually aligns to PAGESIZE not
>> 1024 which is documented in below link, should fix the document as well.
>> 
>> docs.ceph.com/docs/master/man/8/mount.ceph/
>> 
>> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
>> ---
>> fs/ceph/super.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
>> index b33082e6878f..465861959a6b 100644
>> --- a/fs/ceph/super.c
>> +++ b/fs/ceph/super.c
>> @@ -268,7 +268,7 @@ static int parse_fsopt_token(char *c, void *private)
>> 	case Opt_rasize:
>> 		if (intval < 0)
>> 			return -EINVAL;
>> -		fsopt->rasize = ALIGN(intval + PAGE_SIZE - 1, PAGE_SIZE);
>> +		fsopt->rasize = ALIGN(intval, PAGE_SIZE);
> 
> if intval is 2048, ALIGN(intval, PAGE_SIZE) is 0.  why do you want to make this change?

Hi Yan,

Thanks for you quick reply.

I think it aligns up, so it will be 4096 unless you specify rasize=0.

The motivation of this patch is avoiding confusion about specifying rasize.

On currently logic:
when I specify rasize=0~1 then it will be 4096.
when I specify rasize=2~4097 then it will be 8192.

I think the result will easily cause user’s confusion.

Thanks,
Chengguang.




--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dongsheng Yang May 30, 2018, 3:18 a.m. UTC | #3
Then maybe it would be

fsopt->rasize = ALIGN_DOWN(intval + PAGE_SIZE - 1, PAGE_SIZE);

Thanx


On 05/30/2018 10:45 AM, cgxu519@gmx.com wrote:
> fsopt->rasize = ALIGN(intval + PAGE_SIZE - 1, PAGE_SIZE);


--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yan, Zheng May 30, 2018, 3:21 a.m. UTC | #4
> On May 30, 2018, at 10:45, cgxu519@gmx.com wrote:
> 
>> 
>> 在 2018年5月30日,上午10:16,Yan, Zheng <zyan@redhat.com> 写道:
>> 
>> 
>> 
>>> On May 30, 2018, at 10:13, Chengguang Xu <cgxu519@gmx.com> wrote:
>>> 
>>> Fix improper rasize alignment.
>>> 
>>> Based on code, rasize(max readahead) actually aligns to PAGESIZE not
>>> 1024 which is documented in below link, should fix the document as well.
>>> 
>>> docs.ceph.com/docs/master/man/8/mount.ceph/
>>> 
>>> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
>>> ---
>>> fs/ceph/super.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>> 
>>> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
>>> index b33082e6878f..465861959a6b 100644
>>> --- a/fs/ceph/super.c
>>> +++ b/fs/ceph/super.c
>>> @@ -268,7 +268,7 @@ static int parse_fsopt_token(char *c, void *private)
>>> 	case Opt_rasize:
>>> 		if (intval < 0)
>>> 			return -EINVAL;
>>> -		fsopt->rasize = ALIGN(intval + PAGE_SIZE - 1, PAGE_SIZE);
>>> +		fsopt->rasize = ALIGN(intval, PAGE_SIZE);
>> 
>> if intval is 2048, ALIGN(intval, PAGE_SIZE) is 0.  why do you want to make this change?
> 
> Hi Yan,
> 
> Thanks for you quick reply.
> 
> I think it aligns up, so it will be 4096 unless you specify rasize=0.
> 

Ok, thanks for explanation. I will add it to our testing branch

Yan, Zheng

> The motivation of this patch is avoiding confusion about specifying rasize.
> 
> On currently logic:
> when I specify rasize=0~1 then it will be 4096.
> when I specify rasize=2~4097 then it will be 8192.
> 
> I think the result will easily cause user’s confusion.
> 
> Thanks,
> Chengguang.

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Chengguang Xu May 30, 2018, 3:26 a.m. UTC | #5
It’s trivial but I don’t see any benefit from it,do you?

Considering rsize & wsize, I would rather to keep same form.



> 在 2018年5月30日,上午11:18,Dongsheng Yang <dongsheng.yang@easystack.cn> 写道:
> 
> 
> Then maybe it would be
> 
> fsopt->rasize = ALIGN_DOWN(intval + PAGE_SIZE - 1, PAGE_SIZE);
> 
> Thanx
> 
> 
> On 05/30/2018 10:45 AM, cgxu519@gmx.com wrote:
>> fsopt->rasize = ALIGN(intval + PAGE_SIZE - 1, PAGE_SIZE);
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dongsheng Yang May 30, 2018, 3:29 a.m. UTC | #6
Ha, that's okey to use ALIGN

On 05/30/2018 11:26 AM, cgxu519@gmx.com wrote:
> It’s trivial but I don’t see any benefit from it,do you?
>
> Considering rsize & wsize, I would rather to keep same form.
>
>
>
>> 在 2018年5月30日,上午11:18,Dongsheng Yang <dongsheng.yang@easystack.cn> 写道:
>>
>>
>> Then maybe it would be
>>
>> fsopt->rasize = ALIGN_DOWN(intval + PAGE_SIZE - 1, PAGE_SIZE);
>>
>> Thanx
>>
>>
>> On 05/30/2018 10:45 AM, cgxu519@gmx.com wrote:
>>> fsopt->rasize = ALIGN(intval + PAGE_SIZE - 1, PAGE_SIZE);
>>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" 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 ceph-devel" 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/ceph/super.c b/fs/ceph/super.c
index b33082e6878f..465861959a6b 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -268,7 +268,7 @@  static int parse_fsopt_token(char *c, void *private)
 	case Opt_rasize:
 		if (intval < 0)
 			return -EINVAL;
-		fsopt->rasize = ALIGN(intval + PAGE_SIZE - 1, PAGE_SIZE);
+		fsopt->rasize = ALIGN(intval, PAGE_SIZE);
 		break;
 	case Opt_caps_wanted_delay_min:
 		if (intval < 1)