public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: dedekind1@gmail.com
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	tlinder@codeaurora.org
Subject: Re: [PATCH 03/35] UBI: Fastmap: Add self check to detect absent PEBs
Date: Wed, 05 Nov 2014 16:56:45 +0100	[thread overview]
Message-ID: <545A48BD.9010904@nod.at> (raw)
In-Reply-To: <1415201029.958.118.camel@sauron.fi.intel.com>

Am 05.11.2014 um 16:23 schrieb Artem Bityutskiy:
> On Wed, 2014-10-29 at 13:45 +0100, Richard Weinberger wrote:
>> This self check allows Fastmap to detect absent PEBs while
>> writing a new fastmap to the MTD device.
>> It will help to find implementation issues in Fastmap.
>>
>> Signed-off-by: Richard Weinberger <richard@nod.at>
>> ---
>>  drivers/mtd/ubi/fastmap.c | 86 +++++++++++++++++++++++++++++++++++++++++++++--
>>  1 file changed, 84 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
>> index cfd5b5e..adccc1f 100644
>> --- a/drivers/mtd/ubi/fastmap.c
>> +++ b/drivers/mtd/ubi/fastmap.c
>> @@ -1,5 +1,6 @@
>>  /*
>>   * Copyright (c) 2012 Linutronix GmbH
>> + * Copyright (c) 2014 sigma star gmbh
>>   * Author: Richard Weinberger <richard@nod.at>
>>   *
>>   * This program is free software; you can redistribute it and/or modify
>> @@ -17,6 +18,69 @@
>>  #include "ubi.h"
>>  
>>  /**
>> + * init_seen - allocate the seen logic integer array
> 
> How about
> 
> init_seen - allocate memory for used for debugging.
> 
> 
> And I think there should be a dot at the end of the title comment. Not
> that it is very important, but I tried to follow this rule everywhere.
> 
>> +/**
>> + * free_seen - free the seen logic integer array
>> + * @seen: integer array of @ubi->peb_count size
>> + */
>> +static inline void free_seen(int *seen)
>> +{
>> +	kfree(seen);
>> +}
> 
> Just do not introduce a function for this. And the commentary does not
> make it any more clear. Or if you are going to add more stuff to this
> function later - rephrase the comment please.

Why? I did that to have alloc and free balanced.
I.e. to not have a naked kfree(). Always when I see a kfree() somewhere
I'd like to see the k*alloc().

>> +/**
>> + * set_seen - mark a PEB as seen
>> + * @ubi: UBI device description object
>> + * @pnum: the to be marked PEB
>> + * @seen: integer array of @ubi->peb_count size
>> + */
> 
> The dot at the end of the title line. And the return code could be
> documented too.

I need a script for this. ;-)

> "The to be marked PEB" is understandable, but not well-said :-)
> 
> Not sure if this adds much value, but I am trying to be consistent.
> 
>> +/**
>> + * self_check_seen - check whether all PEB have been seen by fastmap
>> + * @ubi: UBI device description object
>> + * @seen: integer array of @ubi->peb_count size
>> + */
> 
> Similar nit-picks.
> 
>> +static int self_check_seen(struct ubi_device *ubi, int *seen)
>> +{
>> +	int pnum, ret = 0;
>> +
>> +	if (!ubi_dbg_chk_fastmap(ubi) || !seen)
>> +		return 0;
>> +
>> +	for (pnum = 0; pnum < ubi->peb_count; pnum++) {
>> +		if (!seen[pnum] && ubi->lookuptbl[pnum]) {
>> +			ubi_err("self-check failed for PEB %d, fastmap didn't see it", pnum);
> 
> Didn't Tanya add the 'ubi' parameter in the printing functions?

At the time I wrote this patch Tanya's work was not mainline...

>>  	int scrub_peb_count, erase_peb_count;
>> +	int *seen_pebs = NULL;
> 
> Is the initialization really needed?
> 

Correct, we can drop it.

Thanks,
//richard

  reply	other threads:[~2014-11-05 15:56 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-29 12:45 UBI Fastmap stabilization Richard Weinberger
2014-10-29 12:45 ` [PATCH 01/35] UBI: Add initial support for fastmap self checks Richard Weinberger
2014-12-04 10:52   ` Tanya Brokhman
2014-10-29 12:45 ` [PATCH 02/35] UBI: Fix stale pointers in ubi->lookuptbl Richard Weinberger
2014-11-05 15:14   ` Artem Bityutskiy
2014-12-04 11:00   ` Tanya Brokhman
2014-12-04 11:04     ` Richard Weinberger
2014-12-04 12:37       ` Tanya Brokhman
2014-12-04 12:40         ` Richard Weinberger
2014-10-29 12:45 ` [PATCH 03/35] UBI: Fastmap: Add self check to detect absent PEBs Richard Weinberger
2014-11-05 15:23   ` Artem Bityutskiy
2014-11-05 15:56     ` Richard Weinberger [this message]
2014-11-05 16:01       ` Artem Bityutskiy
2014-11-05 16:05         ` Richard Weinberger
2014-11-06  7:55           ` Artem Bityutskiy
2014-10-29 12:45 ` [PATCH 04/35] UBI: Fastmap: Care about the protection queue Richard Weinberger
2014-10-29 12:45 ` [PATCH 05/35] UBI: Fastmap: Ensure that only one fastmap work is scheduled Richard Weinberger
2014-11-05 15:42   ` Artem Bityutskiy
2014-11-05 15:47     ` Richard Weinberger
2014-10-29 12:45 ` [PATCH 06/35] UBI: Fastmap: Ensure that all fastmap work is done upon WL shutdown Richard Weinberger
2014-11-05 15:45   ` Artem Bityutskiy
2014-11-05 15:49     ` Richard Weinberger
2014-11-05 15:54       ` Artem Bityutskiy
2014-11-05 15:59         ` Richard Weinberger
2014-11-05 16:05           ` Artem Bityutskiy
2014-10-29 12:45 ` [PATCH 07/35] UBI: Fastmap: Fix races in ubi_wl_get_peb() Richard Weinberger
2014-11-05 15:51   ` Artem Bityutskiy
2014-10-29 12:45 ` [PATCH 08/35] UBI: Split __wl_get_peb() Richard Weinberger
2014-11-06  7:51   ` Artem Bityutskiy
2014-11-06  7:55     ` Richard Weinberger
2014-10-29 12:45 ` [PATCH 09/35] UBI: Fastmap: Make ubi_refill_pools() fair Richard Weinberger
2014-10-29 12:45 ` [PATCH 10/35] UBI: Fastmap: Fix memory leaks while closing the WL sub-system Richard Weinberger
2014-10-29 12:45 ` [PATCH 11/35] UBI: Fastmap: Don't allocate new ubi_wl_entry objects Richard Weinberger
2014-10-29 12:45 ` [PATCH 12/35] UBI: Fastmap: Notify user in case of an ubi_update_fastmap() failure Richard Weinberger
2014-10-29 12:45 ` [PATCH 13/35] UBI: Fastmap: Wrap fastmap specific function in a ifdef Richard Weinberger
2014-10-29 12:45 ` [PATCH 14/35] UBI: Fastmap: Fix fastmap usage in ubi_volume_notify() Richard Weinberger
2014-10-29 12:45 ` [PATCH 15/35] UBI: Fastmap: Enhance fastmap checking Richard Weinberger
2014-10-29 12:45 ` [PATCH 16/35] UBI: Fastmap: Fix memory leak while attaching Richard Weinberger
2014-10-29 12:45 ` [PATCH 17/35] UBI: Remove alloc_ai() slab name from parameter list Richard Weinberger
2014-10-29 12:45 ` [PATCH 18/35] UBI: Fastmap: Fix race in ubi_eba_atomic_leb_change() Richard Weinberger
2014-10-29 12:45 ` [PATCH 19/35] UBI: Fastmap: Remove bogus ubi_assert() Richard Weinberger
2014-10-29 12:45 ` [PATCH 20/35] UBI: Fastmap: Remove eba_orphans logic Richard Weinberger
2014-10-29 12:45 ` [PATCH 21/35] UBI: Fastmap: Switch to ro mode if invalidate_fastmap() fails Richard Weinberger
2014-10-29 12:45 ` [PATCH 22/35] UBI: Fastmap: Make WL pool size 50% of user pool size Richard Weinberger
2014-10-29 12:45 ` [PATCH 23/35] UBI: Fastmap: Add new module parameter fm_debug Richard Weinberger
2014-10-29 12:45 ` [PATCH 24/35] UBI: Fastmap: Fix leb_count unbalance Richard Weinberger
2014-10-29 12:45 ` [PATCH 25/35] UBI: Fastmap: Fix race after ubi_wl_get_peb() Richard Weinberger
2014-10-29 12:45 ` [PATCH 26/35] UBI: Fastmap: Set used_ebs only for static volumes Richard Weinberger
2014-10-29 12:45 ` [PATCH 27/35] UBI: Fastmap: Locking updates Richard Weinberger
2014-10-29 12:45 ` [PATCH 28/35] UBI: Fastmap: Make self_check_eba() depend on fastmap self checking Richard Weinberger
2014-10-29 12:45 ` [PATCH 29/35] UBI: Move fastmap specific functions out of wl.c Richard Weinberger
2014-10-29 12:45 ` [PATCH 30/35] UBI: Add accessor functions for WL data structures Richard Weinberger
2014-10-29 12:45 ` [PATCH 31/35] UBI: Fastmap: Wire up WL accessor functions Richard Weinberger
2014-10-29 12:45 ` [PATCH 32/35] UBI: Fastmap: Introduce ubi_fastmap_init() Richard Weinberger
2014-10-29 12:45 ` [PATCH 33/35] UBI: Fastmap: Introduce may_reserve_for_fm() Richard Weinberger
2014-10-29 12:45 ` [PATCH 34/35] UBI: Fastmap: Remove else after return Richard Weinberger
2014-10-29 12:45 ` [PATCH 35/35] UBI: Fastmap: Add blank line after declarations Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=545A48BD.9010904@nod.at \
    --to=richard@nod.at \
    --cc=dedekind1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=tlinder@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox