common: add blkcache init
PATCH 2/5 common: add blkcache init
From: Angelo Durgehello <[email protected]>
On m68k, block_cache list is relocated, but next and prev list pointers are not adjusted to the relocated struct list_head address, so the first iteration over the block_cache list hangs.
This patch initializes the block_cache list after relocation.
--- common/board_r.c | 12 ++++++++++++ drivers/block/blkcache.c | 7 ++++++- include/blk.h | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-)
common/board_r.c +12 -0
@@ -628,6 +628,15 @@ static int initr_bedbug(void) }#endif +#ifdef CONFIG_BLOCK_CACHE +static int initr_blkcache (void ) +{ +blkcache_init (); + +return 0 ; +} +#endif +static int run_main_loop (void ) {#ifdef CONFIG_SANDBOX
@@ -832,6 +841,9 @@ static init_fnc_t init_sequence_r[] = {#endif #if defined(CONFIG_PRAM ) initr_mem, +#endif +#ifdef CONFIG_BLOCK_CACHE + initr_blkcache, #endif run_main_loop, };
drivers/block/blkcache.c +6 -1
@@ -21,13 +21,18 @@ struct block_cache_node {char *cache; }; -static LIST_HEAD (block_cache); +static struct list_head block_cache;static struct block_cache_stats _stats = { .max_blocks_per_entry =8 , .max_entries =32 }; +void blkcache_init (void ) +{ +INIT_LIST_HEAD (&block_cache); +} +static struct block_cache_node *cache_find (int iftype,int devnum,lbaint_t start,lbaint_t blkcnt,unsigned long blksz)
include/blk.h +6 -0
@@ -113,6 +113,12 @@ struct blk_desc { (PAD_SIZE(size, blk_desc->blksz))#if CONFIG_IS_ENABLED (BLOCK_CACHE ) + +/** +* blkcache_init() - initialize the block cache list pointers +*/ +void blkcache_init (void ); +/** * blkcache_read() - attempt to read a set of blocks from cache *
Signature · 1 line
2.24.0
PATCH 2/5 common: add blkcache init
Hi Angelo,
Quoted 22 lines · Angelo Dureghello
From: Angelo Durgehello <[email protected]>
On m68k,
block_cachelist is relocated, but next and prev list pointers are not adjusted to the relocated structlist_headaddress, so the first iteration over theblock_cachelist hangs.This patch initializes the
block_cachelist after relocation.Signed-off-by Angelo Durgehello <[email protected]>--- common/board_r.c | 12 ++++++++++++ drivers/block/blkcache.c | 7 ++++++- include/blk.h | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-)common/board_r.c +0
-0@@ -628,6 +628,15 @@ static int initr_bedbug(void) }#endif
common/board_r.c static int initr_bedbug(void) · line 639
Quoted 10 lines
common/board_r.c +9
-0+#ifdef CONFIG_BLOCK_CACHE +static int initr_blkcache (void ) +{ +blkcache_init (); + +return 0 ; +} +#endif +
Why the extra level of indirection?
common/board_r.c static init_fnc_t init_sequence_r[] = { · line 845
Quoted 9 lines
common/board_r.c +2
-0static int run_main_loop (void ) {#ifdef CONFIG_SANDBOX @@ -832,6 +841,9 @@ static init_fnc_t init_sequence_r[] = {#endif #if defined(CONFIG_PRAM ) initr_mem, +#endif +#ifdef CONFIG_BLOCK_CACHE
It seems you could call blkcache_init from here directly:
Quoted 46 lines
common/board_r.c +1
-0+ initr_blkcache, #endif run_main_loop, };drivers/block/blkcache.c +6
-1@@ -21,13 +21,18 @@ struct block_cache_node {char *cache; }; -static LIST_HEAD (block_cache); +static struct list_head block_cache;static struct block_cache_stats _stats = { .max_blocks_per_entry =8 , .max_entries =32 }; +void blkcache_init (void ) +{ +INIT_LIST_HEAD (&block_cache); +} +static struct block_cache_node *cache_find (int iftype,int devnum,lbaint_t start,lbaint_t blkcnt,unsigned long blksz)include/blk.h +6
-0@@ -113,6 +113,12 @@ struct blk_desc { (PAD_SIZE(size, blk_desc->blksz))#if CONFIG_IS_ENABLED (BLOCK_CACHE ) + +/** +* blkcache_init() - initialize the block cache list pointers +*/ +void blkcache_init (void ); +/** * blkcache_read() - attempt to read a set of blocks from cache *
PATCH 2/5 common: add blkcache init
Hi Eric,
Quoted 39 lines · Eric Nelson
Hi Angelo,
Quoted 22 lines · Angelo Dureghello
From: Angelo Durgehello <[email protected]>
On m68k,
block_cachelist is relocated, but next and prev list pointers are not adjusted to the relocated structlist_headaddress, so the first iteration over theblock_cachelist hangs.This patch initializes the
block_cachelist after relocation.Signed-off-by Angelo Durgehello <[email protected]>--- common/board_r.c | 12 ++++++++++++ drivers/block/blkcache.c | 7 ++++++- include/blk.h | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-)common/board_r.c +0
-0@@ -628,6 +628,15 @@ static int initr_bedbug(void) }#endif common/board_r.c static int initr_bedbug(void) · line 639
Quoted 10 lines
common/board_r.c +9
-0+#ifdef CONFIG_BLOCK_CACHE +static int initr_blkcache (void ) +{ +blkcache_init (); + +return 0 ; +} +#endif +Why the extra level of indirection?
Quoted 12 lines
common/board_r.c static init_fnc_t init_sequence_r[] = { · line 845
Quoted 9 lines
common/board_r.c +2
-0static int run_main_loop (void ) {#ifdef CONFIG_SANDBOX @@ -832,6 +841,9 @@ static init_fnc_t init_sequence_r[] = {#endif #if defined(CONFIG_PRAM ) initr_mem, +#endif +#ifdef CONFIG_BLOCK_CACHE It seems you could call
blkcache_initfrom here directly:
reason for this is to maintain "initr_" naming convention, used from quite all the initr_ calls,
as i.e. static int initr_mmc(void) that's doing the same.
Quoted 36 lines
Quoted 36 lines
common/board_r.c +1
-0+ initr_blkcache, #endif run_main_loop, };drivers/block/blkcache.c +6
-1@@ -21,13 +21,18 @@ struct block_cache_node {char *cache; }; -static LIST_HEAD (block_cache); +static struct list_head block_cache;static struct block_cache_stats _stats = { .max_blocks_per_entry =8 , .max_entries =32 }; +void blkcache_init (void ) +{ +INIT_LIST_HEAD (&block_cache); +} +static struct block_cache_node *cache_find (int iftype,int devnum,lbaint_t start,lbaint_t blkcnt,unsigned long blksz)include/blk.h +0
-0@@ -113,6 +113,12 @@ struct blk_desc { (PAD_SIZE (size, blk_desc->blksz))
Quoted 12 lines
include/blk.h struct blk_desc { · line 124
Quoted 11 lines
include/blk.h +6
-0#if CONFIG_IS_ENABLED (BLOCK_CACHE ) + +/** +* blkcache_init() - initialize the block cache list pointers +*/ +void blkcache_init (void ); +/** * blkcache_read() - attempt to read a set of blocks from cache *
Regards,
--
Angelo Dureghello
PATCH 2/5 common: add blkcache init
Hi Angelo,
Quoted 55 lines · Angelo Dureghello
Hi Eric,
Quoted 39 lines · Eric Nelson
Hi Angelo,
Quoted 22 lines · Angelo Dureghello
From: Angelo Durgehello <[email protected]>
On m68k,
block_cachelist is relocated, but next and prev list pointers are not adjusted to the relocated structlist_headaddress, so the first iteration over theblock_cachelist hangs.This patch initializes the
block_cachelist after relocation.Signed-off-by Angelo Durgehello <[email protected]>--- common/board_r.c | 12 ++++++++++++ drivers/block/blkcache.c | 7 ++++++- include/blk.h | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-)common/board_r.c +0
-0@@ -628,6 +628,15 @@ static int initr_bedbug(void) }#endif common/board_r.c static int initr_bedbug(void) · line 639
Quoted 10 lines
common/board_r.c +9
-0+#ifdef CONFIG_BLOCK_CACHE +static int initr_blkcache (void ) +{ +blkcache_init (); + +return 0 ; +} +#endif +Why the extra level of indirection?
Quoted 12 lines
common/board_r.c static init_fnc_t init_sequence_r[] = { · line 845
Quoted 9 lines
common/board_r.c +2
-0static int run_main_loop (void ) {#ifdef CONFIG_SANDBOX @@ -832,6 +841,9 @@ static init_fnc_t init_sequence_r[] = {#endif #if defined(CONFIG_PRAM ) initr_mem, +#endif +#ifdef CONFIG_BLOCK_CACHE It seems you could call
blkcache_initfrom here directly:
Quoted 4 lines
reason for this is to maintain "
initr_" naming convention, used from quite all theinitr_calls,
as i.e. static intinitr_mmc(void)that's doing the same.
Okay. I think this isn't a hard rule though (see log_init, stdio_init_tables, etc).
I'm not sure that it would be a bad thing to rename blkcache_init to initr_blkcache to indicate the usage.
Quoted 52 lines
Quoted 36 lines
Quoted 36 lines
common/board_r.c +1
-0+ initr_blkcache, #endif run_main_loop, };drivers/block/blkcache.c +6
-1@@ -21,13 +21,18 @@ struct block_cache_node {char *cache; }; -static LIST_HEAD (block_cache); +static struct list_head block_cache;static struct block_cache_stats _stats = { .max_blocks_per_entry =8 , .max_entries =32 }; +void blkcache_init (void ) +{ +INIT_LIST_HEAD (&block_cache); +} +static struct block_cache_node *cache_find (int iftype,int devnum,lbaint_t start,lbaint_t blkcnt,unsigned long blksz)include/blk.h +0
-0@@ -113,6 +113,12 @@ struct blk_desc { (PAD_SIZE (size, blk_desc->blksz))Quoted 12 lines
include/blk.h struct blk_desc { · line 124
Quoted 11 lines
include/blk.h +6
-0#if CONFIG_IS_ENABLED (BLOCK_CACHE ) + +/** +* blkcache_init() - initialize the block cache list pointers +*/ +void blkcache_init (void ); +/** * blkcache_read() - attempt to read a set of blocks from cache * Regards,
--
Angelo Dureghello
PATCH 2/5 common: add blkcache init
In reply to Angelo DureghelloHi Angelo,
Quoted 55 lines · Angelo Dureghello
Hi Eric,
Quoted 39 lines · Eric Nelson
Hi Angelo,
Quoted 22 lines · Angelo Dureghello
From: Angelo Durgehello <[email protected]>
On m68k,
block_cachelist is relocated, but next and prev list pointers are not adjusted to the relocated structlist_headaddress, so the first iteration over theblock_cachelist hangs.This patch initializes the
block_cachelist after relocation.Signed-off-by Angelo Durgehello <[email protected]>--- common/board_r.c | 12 ++++++++++++ drivers/block/blkcache.c | 7 ++++++- include/blk.h | 6 ++++++ 3 files changed, 24 insertions(+), 1 deletion(-)common/board_r.c +0
-0@@ -628,6 +628,15 @@ static int initr_bedbug(void) }#endif common/board_r.c static int initr_bedbug(void) · line 639
Quoted 10 lines
common/board_r.c +9
-0+#ifdef CONFIG_BLOCK_CACHE +static int initr_blkcache (void ) +{ +blkcache_init (); + +return 0 ; +} +#endif +Why the extra level of indirection?
Quoted 12 lines
common/board_r.c static init_fnc_t init_sequence_r[] = { · line 845
Quoted 9 lines
common/board_r.c +2
-0static int run_main_loop (void ) {#ifdef CONFIG_SANDBOX @@ -832,6 +841,9 @@ static init_fnc_t init_sequence_r[] = {#endif #if defined(CONFIG_PRAM ) initr_mem, +#endif +#ifdef CONFIG_BLOCK_CACHE It seems you could call
blkcache_initfrom here directly:
Quoted 4 lines
reason for this is to maintain "
initr_" naming convention, used from quite all theinitr_calls,
as i.e. static intinitr_mmc(void)that's doing the same.
Okay. I think this isn't a hard rule though (see log_init, stdio_init_tables, etc).
I'm not sure that it would be a bad thing to rename blkcache_init to initr_blkcache to indicate the usage.
Quoted 52 lines
Quoted 36 lines
Quoted 36 lines
common/board_r.c +1
-0+ initr_blkcache, #endif run_main_loop, };drivers/block/blkcache.c +6
-1@@ -21,13 +21,18 @@ struct block_cache_node {char *cache; }; -static LIST_HEAD (block_cache); +static struct list_head block_cache;static struct block_cache_stats _stats = { .max_blocks_per_entry =8 , .max_entries =32 }; +void blkcache_init (void ) +{ +INIT_LIST_HEAD (&block_cache); +} +static struct block_cache_node *cache_find (int iftype,int devnum,lbaint_t start,lbaint_t blkcnt,unsigned long blksz)include/blk.h +0
-0@@ -113,6 +113,12 @@ struct blk_desc { (PAD_SIZE (size, blk_desc->blksz))Quoted 12 lines
include/blk.h struct blk_desc { · line 124
Quoted 11 lines
include/blk.h +6
-0#if CONFIG_IS_ENABLED (BLOCK_CACHE ) + +/** +* blkcache_init() - initialize the block cache list pointers +*/ +void blkcache_init (void ); +/** * blkcache_read() - attempt to read a set of blocks from cache * Regards,
--
Angelo Dureghello