diff mbox

[4/6] lightnvm: pblk: improve error message if down_timeout fails

Message ID 20170921112729.GA28553@dhcp-216.srv.tuxera.com (mailing list archive)
State New, archived
Headers show

Commit Message

Rakesh Pandit Sept. 21, 2017, 11:27 a.m. UTC
The two pr_err messages are useless as they don't even differentiate
error code.

Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
---
 drivers/lightnvm/pblk-core.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

=?UTF-8?q?Javier=20Gonz=C3=A1lez?= Sept. 22, 2017, 8:55 a.m. UTC | #1
> On 21 Sep 2017, at 13.27, Rakesh Pandit <rakesh@tuxera.com> wrote:
> 
> The two pr_err messages are useless as they don't even differentiate
> error code.
> 
> Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
> ---
> drivers/lightnvm/pblk-core.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
> index b92eabc..74ddb30 100644
> --- a/drivers/lightnvm/pblk-core.c
> +++ b/drivers/lightnvm/pblk-core.c
> @@ -1734,16 +1734,8 @@ static void __pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list,
> #endif
> 
> 	ret = down_timeout(&rlun->wr_sem, msecs_to_jiffies(30000));
> -	if (ret) {
> -		switch (ret) {
> -		case -ETIME:
> -			pr_err("pblk: lun semaphore timed out\n");
> -			break;
> -		case -EINTR:
> -			pr_err("pblk: lun semaphore timed out\n");
> -			break;
> -		}
> -	}
> +	if (ret == -ETIME || ret == -EINTR)
> +		pr_err("pblk: taking lun semaphore timed out: err %d\n", -ret);
> }
> 
> void pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas)
> --
> 2.5.0

Looks good.


Reviewed-by: Javier González <javier@cnexlabs.com>
Matias Bjorling Sept. 25, 2017, 10:15 a.m. UTC | #2
On 09/22/2017 10:55 AM, Javier González wrote:
>> On 21 Sep 2017, at 13.27, Rakesh Pandit <rakesh@tuxera.com> wrote:
>>
>> The two pr_err messages are useless as they don't even differentiate
>> error code.
>>
>> Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
>> ---
>> drivers/lightnvm/pblk-core.c | 12 ++----------
>> 1 file changed, 2 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
>> index b92eabc..74ddb30 100644
>> --- a/drivers/lightnvm/pblk-core.c
>> +++ b/drivers/lightnvm/pblk-core.c
>> @@ -1734,16 +1734,8 @@ static void __pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list,
>> #endif
>>
>> 	ret = down_timeout(&rlun->wr_sem, msecs_to_jiffies(30000));
>> -	if (ret) {
>> -		switch (ret) {
>> -		case -ETIME:
>> -			pr_err("pblk: lun semaphore timed out\n");
>> -			break;
>> -		case -EINTR:
>> -			pr_err("pblk: lun semaphore timed out\n");
>> -			break;
>> -		}
>> -	}
>> +	if (ret == -ETIME || ret == -EINTR)
>> +		pr_err("pblk: taking lun semaphore timed out: err %d\n", -ret);
>> }
>>
>> void pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas)
>> --
>> 2.5.0
> 
> Looks good.
> 
> 
> Reviewed-by: Javier González <javier@cnexlabs.com>
> 
Thanks, I picked it up.
diff mbox

Patch

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index b92eabc..74ddb30 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -1734,16 +1734,8 @@  static void __pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list,
 #endif
 
 	ret = down_timeout(&rlun->wr_sem, msecs_to_jiffies(30000));
-	if (ret) {
-		switch (ret) {
-		case -ETIME:
-			pr_err("pblk: lun semaphore timed out\n");
-			break;
-		case -EINTR:
-			pr_err("pblk: lun semaphore timed out\n");
-			break;
-		}
-	}
+	if (ret == -ETIME || ret == -EINTR)
+		pr_err("pblk: taking lun semaphore timed out: err %d\n", -ret);
 }
 
 void pblk_down_page(struct pblk *pblk, struct ppa_addr *ppa_list, int nr_ppas)