diff mbox

[1/3] ore: (trivial) reformat some code

Message ID 53467757.40909@panasas.com (mailing list archive)
State New, archived
Headers show

Commit Message

Boaz Harrosh April 10, 2014, 10:49 a.m. UTC
rearrange some source lines. Nothing changed.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/exofs/ore.c      | 19 ++++++++-----------
 fs/exofs/ore_raid.c |  4 +---
 2 files changed, 9 insertions(+), 14 deletions(-)

Comments

Mkrtchyan, Tigran April 11, 2014, 11:12 a.m. UTC | #1
----- Original Message -----
> From: "Boaz Harrosh" <bharrosh@panasas.com>
> To: "open-osd" <osd-dev@open-osd.org>, "NFS list" <linux-nfs@vger.kernel.org>, "Daniel Gryniewicz"
> <dang@linuxbox.com>, "Elizabeth Ellenbogen Ziph" <elizabeth@linuxbox.com>, "Santosh Pathak" <santoshp@panasas.com>
> Cc: "Benny Halevy" <bhalevy@primarydata.com>, "Sachin bhamare" <sachin.bhamare@gmail.com>
> Sent: Thursday, April 10, 2014 12:49:59 PM
> Subject: [PATCH 1/3] ore: (trivial) reformat some code
> 
> 
> rearrange some source lines. Nothing changed.
> 
> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
> ---
>  fs/exofs/ore.c      | 19 ++++++++-----------
>  fs/exofs/ore_raid.c |  4 +---
>  2 files changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/exofs/ore.c b/fs/exofs/ore.c
> index dae8846..98f2137 100644
> --- a/fs/exofs/ore.c
> +++ b/fs/exofs/ore.c
> @@ -675,8 +675,8 @@ static int _prepare_for_striping(struct ore_io_state
> *ios)
>  	si->cur_pg = si->unit_off / PAGE_SIZE;
>  
>  	while (length) {
> -		unsigned comp = dev - first_dev;
> -		struct ore_per_dev_state *per_dev = &ios->per_dev[comp];
> +		struct ore_per_dev_state *per_dev =
> +						&ios->per_dev[dev - first_dev];
>  		unsigned cur_len, page_off = 0;
>  
>  		if (!per_dev->length) {
> @@ -708,11 +708,9 @@ static int _prepare_for_striping(struct ore_io_state
> *ios)
>  		if (unlikely(ret))
>  			goto out;
>  
> -		dev += mirrors_p1;
> -		dev = (dev % devs_in_group) + first_dev;
> -
>  		length -= cur_len;
>  
> +		dev = ((dev + mirrors_p1) % devs_in_group) + first_dev;
>  		si->cur_comp = (si->cur_comp + 1) % group_width;
>  		if (unlikely((dev == si->par_dev) || (!length && ios->sp2d))) {
>  			if (!length && ios->sp2d) {
> @@ -721,11 +719,6 @@ static int _prepare_for_striping(struct ore_io_state
> *ios)
>  				 */
>  				dev = si->par_dev;
>  			}
> -			if (ios->sp2d)
> -				/* In writes cur_len just means if it's the
> -				 * last one. See _ore_add_parity_unit.
> -				 */
> -				cur_len = length;
>  			per_dev = &ios->per_dev[dev - first_dev];
>  			if (!per_dev->length) {
>  				/* Only/always the parity unit of the first
> @@ -736,7 +729,11 @@ static int _prepare_for_striping(struct ore_io_state
> *ios)
>  				per_dev->offset = si->obj_offset - si->unit_off;
>  			}
>  
> -			ret = _ore_add_parity_unit(ios, si, per_dev, cur_len);
> +			/* In writes cur_len just means if it's the
> +			 * last one. See _ore_add_parity_unit.
> +			 */
> +			ret = _ore_add_parity_unit(ios, si, per_dev,
> +						   ios->sp2d : length : cur_len);

Hi Boaz, 

did you meant
 
     ios->sp2d ? length : cur_len);

Tigran.
>  			if (unlikely(ret))
>  					goto out;
>  
> diff --git a/fs/exofs/ore_raid.c b/fs/exofs/ore_raid.c
> index 4e2c032..af417d3 100644
> --- a/fs/exofs/ore_raid.c
> +++ b/fs/exofs/ore_raid.c
> @@ -226,9 +226,7 @@ static void _gen_xor_unit(struct __stripe_pages_2d *sp2d)
>  
>  		init_async_submit(&_1ps->submit,
>  			ASYNC_TX_XOR_ZERO_DST | ASYNC_TX_ACK,
> -			NULL,
> -			NULL, NULL,
> -			(addr_conv_t *)_1ps->scribble);
> +			NULL, NULL, NULL, (addr_conv_t *)_1ps->scribble);
>  
>  		/* TODO: raid6 */
>  		_1ps->tx = async_xor(_1ps->pages[sp2d->data_devs], _1ps->pages,
> --
> 1.9.0
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Boaz Harrosh April 12, 2014, 9:07 a.m. UTC | #2
On 04/11/2014 02:12 PM, Mkrtchyan, Tigran wrote:
> 
> 
> ----- Original Message -----
>> From: "Boaz Harrosh" <bharrosh@panasas.com>
>> To: "open-osd" <osd-dev@open-osd.org>, "NFS list" <linux-nfs@vger.kernel.org>, "Daniel Gryniewicz"
>> <dang@linuxbox.com>, "Elizabeth Ellenbogen Ziph" <elizabeth@linuxbox.com>, "Santosh Pathak" <santoshp@panasas.com>
>> Cc: "Benny Halevy" <bhalevy@primarydata.com>, "Sachin bhamare" <sachin.bhamare@gmail.com>
>> Sent: Thursday, April 10, 2014 12:49:59 PM
>> Subject: [PATCH 1/3] ore: (trivial) reformat some code
>>
>>
>> rearrange some source lines. Nothing changed.
>>
>> Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
>> ---
>>  fs/exofs/ore.c      | 19 ++++++++-----------
>>  fs/exofs/ore_raid.c |  4 +---
>>  2 files changed, 9 insertions(+), 14 deletions(-)
>>
>> diff --git a/fs/exofs/ore.c b/fs/exofs/ore.c
>> index dae8846..98f2137 100644
>> --- a/fs/exofs/ore.c
>> +++ b/fs/exofs/ore.c
>> @@ -675,8 +675,8 @@ static int _prepare_for_striping(struct ore_io_state
>> *ios)
>>  	si->cur_pg = si->unit_off / PAGE_SIZE;
>>  
>>  	while (length) {
>> -		unsigned comp = dev - first_dev;
>> -		struct ore_per_dev_state *per_dev = &ios->per_dev[comp];
>> +		struct ore_per_dev_state *per_dev =
>> +						&ios->per_dev[dev - first_dev];
>>  		unsigned cur_len, page_off = 0;
>>  
>>  		if (!per_dev->length) {
>> @@ -708,11 +708,9 @@ static int _prepare_for_striping(struct ore_io_state
>> *ios)
>>  		if (unlikely(ret))
>>  			goto out;
>>  
>> -		dev += mirrors_p1;
>> -		dev = (dev % devs_in_group) + first_dev;
>> -
>>  		length -= cur_len;
>>  
>> +		dev = ((dev + mirrors_p1) % devs_in_group) + first_dev;
>>  		si->cur_comp = (si->cur_comp + 1) % group_width;
>>  		if (unlikely((dev == si->par_dev) || (!length && ios->sp2d))) {
>>  			if (!length && ios->sp2d) {
>> @@ -721,11 +719,6 @@ static int _prepare_for_striping(struct ore_io_state
>> *ios)
>>  				 */
>>  				dev = si->par_dev;
>>  			}
>> -			if (ios->sp2d)
>> -				/* In writes cur_len just means if it's the
>> -				 * last one. See _ore_add_parity_unit.
>> -				 */
>> -				cur_len = length;
>>  			per_dev = &ios->per_dev[dev - first_dev];
>>  			if (!per_dev->length) {
>>  				/* Only/always the parity unit of the first
>> @@ -736,7 +729,11 @@ static int _prepare_for_striping(struct ore_io_state
>> *ios)
>>  				per_dev->offset = si->obj_offset - si->unit_off;
>>  			}
>>  
>> -			ret = _ore_add_parity_unit(ios, si, per_dev, cur_len);
>> +			/* In writes cur_len just means if it's the
>> +			 * last one. See _ore_add_parity_unit.
>> +			 */
>> +			ret = _ore_add_parity_unit(ios, si, per_dev,
>> +						   ios->sp2d : length : cur_len);
> 
> Hi Boaz, 
> 
> did you meant
>  
>      ios->sp2d ? length : cur_len);

my god yes!! why doe it compile? 

Thanks man
Boaz

> 
> Tigran.
>>  			if (unlikely(ret))
>>  					goto out;
>>  
>> diff --git a/fs/exofs/ore_raid.c b/fs/exofs/ore_raid.c
>> index 4e2c032..af417d3 100644
>> --- a/fs/exofs/ore_raid.c
>> +++ b/fs/exofs/ore_raid.c
>> @@ -226,9 +226,7 @@ static void _gen_xor_unit(struct __stripe_pages_2d *sp2d)
>>  
>>  		init_async_submit(&_1ps->submit,
>>  			ASYNC_TX_XOR_ZERO_DST | ASYNC_TX_ACK,
>> -			NULL,
>> -			NULL, NULL,
>> -			(addr_conv_t *)_1ps->scribble);
>> +			NULL, NULL, NULL, (addr_conv_t *)_1ps->scribble);
>>  
>>  		/* TODO: raid6 */
>>  		_1ps->tx = async_xor(_1ps->pages[sp2d->data_devs], _1ps->pages,
>> --
>> 1.9.0
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Boaz Harrosh April 12, 2014, 9:26 a.m. UTC | #3
On 04/12/2014 12:07 PM, Boaz Harrosh wrote:
>>> -			ret = _ore_add_parity_unit(ios, si, per_dev, cur_len);
>>> +			/* In writes cur_len just means if it's the
>>> +			 * last one. See _ore_add_parity_unit.
>>> +			 */
>>> +			ret = _ore_add_parity_unit(ios, si, per_dev,
>>> +						   ios->sp2d : length : cur_len);
>>
>> Hi Boaz, 
>>
>> did you meant
>>  
>>      ios->sp2d ? length : cur_len);
> 
> my god yes!! why doe it compile? 
> 
> Thanks man
> Boaz
> 

OK Now I know. This same line changes again in the last patch and there
it is correct. I have only always tested the 3 together so it never showed
up. I'll fix it for the next round

Thanks for the catch, you saved me. Beers on me next time
Boaz


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" 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/exofs/ore.c b/fs/exofs/ore.c
index dae8846..98f2137 100644
--- a/fs/exofs/ore.c
+++ b/fs/exofs/ore.c
@@ -675,8 +675,8 @@  static int _prepare_for_striping(struct ore_io_state *ios)
 	si->cur_pg = si->unit_off / PAGE_SIZE;
 
 	while (length) {
-		unsigned comp = dev - first_dev;
-		struct ore_per_dev_state *per_dev = &ios->per_dev[comp];
+		struct ore_per_dev_state *per_dev =
+						&ios->per_dev[dev - first_dev];
 		unsigned cur_len, page_off = 0;
 
 		if (!per_dev->length) {
@@ -708,11 +708,9 @@  static int _prepare_for_striping(struct ore_io_state *ios)
 		if (unlikely(ret))
 			goto out;
 
-		dev += mirrors_p1;
-		dev = (dev % devs_in_group) + first_dev;
-
 		length -= cur_len;
 
+		dev = ((dev + mirrors_p1) % devs_in_group) + first_dev;
 		si->cur_comp = (si->cur_comp + 1) % group_width;
 		if (unlikely((dev == si->par_dev) || (!length && ios->sp2d))) {
 			if (!length && ios->sp2d) {
@@ -721,11 +719,6 @@  static int _prepare_for_striping(struct ore_io_state *ios)
 				 */
 				dev = si->par_dev;
 			}
-			if (ios->sp2d)
-				/* In writes cur_len just means if it's the
-				 * last one. See _ore_add_parity_unit.
-				 */
-				cur_len = length;
 			per_dev = &ios->per_dev[dev - first_dev];
 			if (!per_dev->length) {
 				/* Only/always the parity unit of the first
@@ -736,7 +729,11 @@  static int _prepare_for_striping(struct ore_io_state *ios)
 				per_dev->offset = si->obj_offset - si->unit_off;
 			}
 
-			ret = _ore_add_parity_unit(ios, si, per_dev, cur_len);
+			/* In writes cur_len just means if it's the
+			 * last one. See _ore_add_parity_unit.
+			 */
+			ret = _ore_add_parity_unit(ios, si, per_dev,
+						   ios->sp2d : length : cur_len);
 			if (unlikely(ret))
 					goto out;
 
diff --git a/fs/exofs/ore_raid.c b/fs/exofs/ore_raid.c
index 4e2c032..af417d3 100644
--- a/fs/exofs/ore_raid.c
+++ b/fs/exofs/ore_raid.c
@@ -226,9 +226,7 @@  static void _gen_xor_unit(struct __stripe_pages_2d *sp2d)
 
 		init_async_submit(&_1ps->submit,
 			ASYNC_TX_XOR_ZERO_DST | ASYNC_TX_ACK,
-			NULL,
-			NULL, NULL,
-			(addr_conv_t *)_1ps->scribble);
+			NULL, NULL, NULL, (addr_conv_t *)_1ps->scribble);
 
 		/* TODO: raid6 */
 		_1ps->tx = async_xor(_1ps->pages[sp2d->data_devs], _1ps->pages,