2020-08-25 05:02:05

by Joe Perches

[permalink] [raw]
Subject: [PATCH 13/29] bcache: Avoid comma separated statements

Use semicolons and braces.

Signed-off-by: Joe Perches <[email protected]>
---
drivers/md/bcache/bset.c | 12 ++++++++----
drivers/md/bcache/sysfs.c | 6 ++++--
2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
index 67a2c47f4201..94d38e8a59b3 100644
--- a/drivers/md/bcache/bset.c
+++ b/drivers/md/bcache/bset.c
@@ -712,8 +712,10 @@ void bch_bset_build_written_tree(struct btree_keys *b)
for (j = inorder_next(0, t->size);
j;
j = inorder_next(j, t->size)) {
- while (bkey_to_cacheline(t, k) < cacheline)
- prev = k, k = bkey_next(k);
+ while (bkey_to_cacheline(t, k) < cacheline) {
+ prev = k;
+ k = bkey_next(k);
+ }

t->prev[j] = bkey_u64s(prev);
t->tree[j].m = bkey_to_cacheline_offset(t, cacheline++, k);
@@ -901,8 +903,10 @@ unsigned int bch_btree_insert_key(struct btree_keys *b, struct bkey *k,
status = BTREE_INSERT_STATUS_INSERT;

while (m != bset_bkey_last(i) &&
- bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0)
- prev = m, m = bkey_next(m);
+ bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0) {
+ prev = m;
+ m = bkey_next(m);
+ }

/* prev is in the tree, if we merge we're done */
status = BTREE_INSERT_STATUS_BACK_MERGE;
diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
index ac06c0bc3c0a..1878c5ee53b6 100644
--- a/drivers/md/bcache/sysfs.c
+++ b/drivers/md/bcache/sysfs.c
@@ -1071,8 +1071,10 @@ SHOW(__bch_cache)
--n;

while (cached < p + n &&
- *cached == BTREE_PRIO)
- cached++, n--;
+ *cached == BTREE_PRIO) {
+ cached++;
+ n--;
+ }

for (i = 0; i < n; i++)
sum += INITIAL_PRIO - cached[i];
--
2.26.0


2021-01-30 19:01:47

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 13/29] bcache: Avoid comma separated statements

On Mon, 2020-08-24 at 21:56 -0700, Joe Perches wrote:
> Use semicolons and braces.

ping?

> Signed-off-by: Joe Perches <[email protected]>
> ---
> ?drivers/md/bcache/bset.c | 12 ++++++++----
> ?drivers/md/bcache/sysfs.c | 6 ++++--
> ?2 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
> index 67a2c47f4201..94d38e8a59b3 100644
> --- a/drivers/md/bcache/bset.c
> +++ b/drivers/md/bcache/bset.c
> @@ -712,8 +712,10 @@ void bch_bset_build_written_tree(struct btree_keys *b)
> ? for (j = inorder_next(0, t->size);
> ? j;
> ? j = inorder_next(j, t->size)) {
> - while (bkey_to_cacheline(t, k) < cacheline)
> - prev = k, k = bkey_next(k);
> + while (bkey_to_cacheline(t, k) < cacheline) {
> + prev = k;
> + k = bkey_next(k);
> + }
> ?
>
> ? t->prev[j] = bkey_u64s(prev);
> ? t->tree[j].m = bkey_to_cacheline_offset(t, cacheline++, k);
> @@ -901,8 +903,10 @@ unsigned int bch_btree_insert_key(struct btree_keys *b, struct bkey *k,
> ? status = BTREE_INSERT_STATUS_INSERT;
> ?
>
> ? while (m != bset_bkey_last(i) &&
> - bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0)
> - prev = m, m = bkey_next(m);
> + bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0) {
> + prev = m;
> + m = bkey_next(m);
> + }
> ?
>
> ? /* prev is in the tree, if we merge we're done */
> ? status = BTREE_INSERT_STATUS_BACK_MERGE;
> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
> index ac06c0bc3c0a..1878c5ee53b6 100644
> --- a/drivers/md/bcache/sysfs.c
> +++ b/drivers/md/bcache/sysfs.c
> @@ -1071,8 +1071,10 @@ SHOW(__bch_cache)
> ? --n;
> ?
>
> ? while (cached < p + n &&
> - *cached == BTREE_PRIO)
> - cached++, n--;
> + *cached == BTREE_PRIO) {
> + cached++;
> + n--;
> + }
> ?
>
> ? for (i = 0; i < n; i++)
> ? sum += INITIAL_PRIO - cached[i];


2021-01-31 21:33:00

by Coly Li

[permalink] [raw]
Subject: Re: [PATCH 13/29] bcache: Avoid comma separated statements

On 1/31/21 2:59 AM, Joe Perches wrote:
> On Mon, 2020-08-24 at 21:56 -0700, Joe Perches wrote:
>> Use semicolons and braces.
>
> ping?

It is in my for-next now, thanks for reminding.


Coly Li


>
>> Signed-off-by: Joe Perches <[email protected]>
>> ---
>>  drivers/md/bcache/bset.c | 12 ++++++++----
>>  drivers/md/bcache/sysfs.c | 6 ++++--
>>  2 files changed, 12 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
>> index 67a2c47f4201..94d38e8a59b3 100644
>> --- a/drivers/md/bcache/bset.c
>> +++ b/drivers/md/bcache/bset.c
>> @@ -712,8 +712,10 @@ void bch_bset_build_written_tree(struct btree_keys *b)
>>   for (j = inorder_next(0, t->size);
>>   j;
>>   j = inorder_next(j, t->size)) {
>> - while (bkey_to_cacheline(t, k) < cacheline)
>> - prev = k, k = bkey_next(k);
>> + while (bkey_to_cacheline(t, k) < cacheline) {
>> + prev = k;
>> + k = bkey_next(k);
>> + }
>>  
>>
>>   t->prev[j] = bkey_u64s(prev);
>>   t->tree[j].m = bkey_to_cacheline_offset(t, cacheline++, k);
>> @@ -901,8 +903,10 @@ unsigned int bch_btree_insert_key(struct btree_keys *b, struct bkey *k,
>>   status = BTREE_INSERT_STATUS_INSERT;
>>  
>>
>>   while (m != bset_bkey_last(i) &&
>> - bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0)
>> - prev = m, m = bkey_next(m);
>> + bkey_cmp(k, b->ops->is_extents ? &START_KEY(m) : m) > 0) {
>> + prev = m;
>> + m = bkey_next(m);
>> + }
>>  
>>
>>   /* prev is in the tree, if we merge we're done */
>>   status = BTREE_INSERT_STATUS_BACK_MERGE;
>> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
>> index ac06c0bc3c0a..1878c5ee53b6 100644
>> --- a/drivers/md/bcache/sysfs.c
>> +++ b/drivers/md/bcache/sysfs.c
>> @@ -1071,8 +1071,10 @@ SHOW(__bch_cache)
>>   --n;
>>  
>>
>>   while (cached < p + n &&
>> - *cached == BTREE_PRIO)
>> - cached++, n--;
>> + *cached == BTREE_PRIO) {
>> + cached++;
>> + n--;
>> + }
>>  
>>
>>   for (i = 0; i < n; i++)
>>   sum += INITIAL_PRIO - cached[i];
>
>