Skip to content

Commit d679c2e

Browse files
ehristevkees
authored andcommitted
pstore/zone: rewrite some comments for better understanding
Rewrite some comments to make it more clear and easier to understand; fix typos. Signed-off-by: Eugen Hristev <eugen.hristev@linaro.org> Link: https://lore.kernel.org/r/20241224154405.295840-1-eugen.hristev@linaro.org Link: https://lore.kernel.org/r/20250117084228.3218024-1-eugen.hristev@linaro.org Signed-off-by: Kees Cook <kees@kernel.org>
1 parent 8ffd015 commit d679c2e

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

fs/pstore/zone.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct psz_buffer {
4343
*
4444
* @magic: magic num for kmsg dump header
4545
* @time: kmsg dump trigger time
46-
* @compressed: whether conpressed
46+
* @compressed: whether compressed
4747
* @counter: kmsg dump counter
4848
* @reason: the kmsg dump reason (e.g. oops, panic, etc)
4949
* @data: pointer to log data
@@ -214,7 +214,7 @@ static int psz_zone_write(struct pstore_zone *zone,
214214
atomic_set(&zone->buffer->datalen, wlen + off);
215215
}
216216

217-
/* avoid to damage old records */
217+
/* avoid damaging old records */
218218
if (!is_on_panic() && !atomic_read(&pstore_zone_cxt.recovered))
219219
goto dirty;
220220

@@ -249,7 +249,7 @@ static int psz_zone_write(struct pstore_zone *zone,
249249

250250
return 0;
251251
dirty:
252-
/* no need to mark dirty if going to try next zone */
252+
/* no need to mark it dirty if going to try next zone */
253253
if (wcnt == -ENOMSG)
254254
return -ENOMSG;
255255
atomic_set(&zone->dirty, true);
@@ -378,7 +378,7 @@ static int psz_kmsg_recover_meta(struct psz_context *cxt)
378378
struct timespec64 time = { };
379379
unsigned long i;
380380
/*
381-
* Recover may on panic, we can't allocate any memory by kmalloc.
381+
* Recover may happen on panic, we can't allocate any memory by kmalloc.
382382
* So, we use local array instead.
383383
*/
384384
char buffer_header[sizeof(*buf) + sizeof(*hdr)] = {0};
@@ -856,11 +856,11 @@ static int notrace psz_record_write(struct pstore_zone *zone,
856856

857857
/**
858858
* psz_zone_write will set datalen as start + cnt.
859-
* It work if actual data length lesser than buffer size.
860-
* If data length greater than buffer size, pmsg will rewrite to
861-
* beginning of zone, which make buffer->datalen wrongly.
859+
* It works if actual data length is lesser than buffer size.
860+
* If data length is greater than buffer size, pmsg will rewrite to
861+
* the beginning of the zone, which makes buffer->datalen wrong.
862862
* So we should reset datalen as buffer size once actual data length
863-
* greater than buffer size.
863+
* is greater than buffer size.
864864
*/
865865
if (is_full_data) {
866866
atomic_set(&zone->buffer->datalen, zone->buffer_size);
@@ -878,8 +878,9 @@ static int notrace psz_pstore_write(struct pstore_record *record)
878878
atomic_set(&cxt->on_panic, 1);
879879

880880
/*
881-
* if on panic, do not write except panic records
882-
* Fix case that panic_write prints log which wakes up console backend.
881+
* If on panic, do not write anything except panic records.
882+
* Fix the case when panic_write prints log that wakes up
883+
* console backend.
883884
*/
884885
if (is_on_panic() && record->type != PSTORE_TYPE_DMESG)
885886
return -EBUSY;

0 commit comments

Comments
 (0)