Skip to contentSkip to conversation

bcache: correct return value in register_nvdimm_meta()

PATCH In review Coly Li 2 participants 8 messages Feb 10, 2021

Subsystems (2)
lore
Share & tools
lore

Coly Li

author
#0 lore raw

PATCH 1/4 bcache: correct return value in register_nvdimm_meta()

'ret' should be used a return value, thi patch fixes this error.

---
 drivers/md/bcache/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/super.c +1 -1
index c273eeef0d38..47a1225b3496 100644
@@ -2554,7 +2554,7 @@ static ssize_t register_nvdimm_meta(struct kobject *k, struct kobj_attribute *at
 		ret = -EINVAL;
 	}
 
-	return size;
+	return ret;
 }
 #endif
 
Signature · 1 line
2.26.2
author
#1 lore raw

PATCH 2/4 bcache: use div_u64() in init_owner_info()

Kernel test robot reports the build-in u64/u32 in init_owner_info() doesn't work for m68k arch, the explict div_u64() should be used.

This patch explicit uses div_u64() to do the u64/u32 division on 32bit m68k arch.

---
 drivers/md/bcache/nvm-pages.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/nvm-pages.c +1 -1
index c350dcd696dd..8be761467d8f 100644
@@ -521,7 +521,7 @@ static int init_owner_info(struct bch_nvm_namespace *ns)
 	only_set->owner_list_size = owner_list_head->size;
 	only_set->owner_list_used = owner_list_head->used;
 
-	remove_owner_space(ns, 0, ns->pages_offset/ns->page_size);
+	remove_owner_space(ns, 0, div_u64(ns->pages_offset, ns->page_size));
 
 	for (i = 0; i < owner_list_head->used; i++) {
 		owner_head = &owner_list_head->heads[i];
Signature · 1 line
2.26.2
Reviewed-by on v1 2/4
#2 lore raw

Re: [PATCH 2/4] bcache: use div_u64() in init_owner_info()

Quoted 10 lines · Coly Li

Kernel test robot reports the build-in u64/u32 in init_owner_info() doesn't work for m68k arch, the explict div_u64() should be used.

This patch explicit uses div_u64() to do the u64/u32 division on 32bit m68k arch.

Looks good.

author
#3 lore raw

PATCH 3/4 bcache: unify code comments style in nvm-pages.c

In reply to Coly Li

Make nvm-pages.c follow code comments style of other bcache code.

---
 drivers/md/bcache/nvm-pages.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/md/bcache/nvm-pages.c +3 -3
index 8be761467d8f..3ea27ea3dd54 100644
@@ -270,7 +270,7 @@ static void write_owner_info(void)
 	owner_list_head->size = BCH_MAX_OWNER_LIST;
 	WARN_ON(only_set->owner_list_used > owner_list_head->size);
 
-	// in-memory owner maybe not contain alloced-pages.
+	/* in-memory owner maybe not contain alloced-pages. */
 	for (i = 0; i < only_set->owner_list_used; i++) {
 		owner_head = &owner_list_head->heads[i];
 		owner_list = only_set->owner_lists[i];
@@ -569,14 +569,14 @@ static int init_owner_info(struct bch_nvm_namespace *ns)
 					extent->nr = rec->nr;
 					WARN_ON(!is_power_of_2(extent->nr));
 
-					/*init struct page: index/private */
+					/* init struct page: index/private */
 					order = ilog2(extent->nr);
 					page = nvm_vaddr_to_page(ns, extent->kaddr);
 					set_page_private(page, order);
 					page->index = rec->pgoff;
 
 					list_add_tail(&extent->list, &extents->extent_head);
-					/*remove already alloced space*/
+					/* remove already alloced space */
 					remove_owner_space(extents->ns, rec->pgoff, rec->nr);
 				}
 				extents->nr += nvm_pgalloc_recs->used;
Signature · 1 line
2.26.2
author
#5 lore raw

PATCH 4/4 bcache: fix a typo in nvme-pages.c

In reply to Coly Li

This patch fixes a typo in init_owner_info() which causes an invalid pointer checking from a kazlloc().

---
 drivers/md/bcache/nvm-pages.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/bcache/nvm-pages.c +1 -1
index 3ea27ea3dd54..9cf69dc36f3a 100644
@@ -561,7 +561,7 @@ static int init_owner_info(struct bch_nvm_namespace *ns)
 				for (k = 0; k < nvm_pgalloc_recs->used; k++) {
 					rec = &nvm_pgalloc_recs->recs[k];
 					extent = kzalloc(sizeof(*extent), GFP_KERNEL);
-					if (!extents) {
+					if (!extent) {
 						mutex_unlock(&only_set->lock);
 						return -ENOMEM;
 					}
Signature · 1 line
2.26.2
Reviewed-by on v1 4/4
#6 lore raw

Re: [PATCH 4/4] bcache: fix a typo in nvme-pages.c

Quoted 8 lines · Coly Li

This patch fixes a typo in init_owner_info() which causes an invalid pointer checking from a kazlloc().

Looks good.

Reviewed-by on v1 1/4
#7 lore raw
In reply to Coly Li
Quoted 1 line · Coly Li

'ret' should be used a return value, thi patch fixes this error.

How about following commit log ?

The local variable should be used to return right error code from the register_nvdimm_meta() instead of size variable.

Quoted 3 lines

---

Looks good.