dax: use assign_bit() where applicable
PATCH 1/1 dax: use assign_bit() where applicable
From: Peng Fan <[email protected]>
Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
--- drivers/dax/super.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/dax/super.c +1 -4
@@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);void dax_write_cache (struct dax_device *dax_dev,bool wc) { -if (wc) -set_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); -else -clear_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); +assign_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags, wc); }EXPORT_SYMBOL_GPL (dax_write_cache);
Signature · 1 line
2.51.0
Quoted 8 lines
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
From: Peng Fan <[email protected]>
Convert open-coded if/else with set_bit/clear_bit to the
assign_bitAPI.Signed-off-by Peng Fan <[email protected]>
Quoted 24 lines
--- drivers/dax/super.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/dax/super.c +1
-5@@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);void dax_write_cache (struct dax_device *dax_dev,bool wc) { -if (wc) -set_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); -else -clear_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); +assign_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags, wc); }EXPORT_SYMBOL_GPL (dax_write_cache); --2.51.0
Jonathan Cameron
Reviewed-byQuoted 9 lines · Pankaj
Quoted 7 lines
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
From: Peng Fan <[email protected]>
Convert open-coded if/else with set_bit/clear_bit to the
assign_bitAPI.Signed-off-by Peng Fan <[email protected]>Reviewed-by Pankaj Gupta <[email protected]>
A bit marginal wrt to churn but a good change in general. Up to DAX maintainers on whether they want this type of small focused improvement.
Quoted 26 lines
Quoted 25 lines
--- drivers/dax/super.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/dax/super.c +1
-5@@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);void dax_write_cache (struct dax_device *dax_dev,bool wc) { -if (wc) -set_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); -else -clear_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); +assign_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags, wc); }EXPORT_SYMBOL_GPL (dax_write_cache); --2.51.0
Alison Schofield
maintainerQuoted 9 lines · Jonathan Cameron
Quoted 6 lines · Pankaj
Quoted 6 lines
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
From: Peng Fan <[email protected]>
Convert open-coded if/else with set_bit/clear_bit to the
assign_bitAPI.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Peng Fan <[email protected]>Reviewed-by Pankaj Gupta <[email protected]>A bit marginal wrt to churn but a good change in general. Up to DAX maintainers on whether they want this type of small focused improvement.
I didn't see the improvement. When I peruse the file I see set_bit and clear_bit, and now I see a couple of those obfuscated by a new assign_bit, needlessly.
If Peng wants to come back around with a 'why' then I'd take another look. I shared my NAK story here:
https://lore.kernel.org/lkml/[email protected]/
Quoted 30 lines
Reviewed-by Jonathan Cameron <[email protected]>Quoted 26 lines
Quoted 25 lines
--- drivers/dax/super.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/dax/super.c +1
-5@@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);void dax_write_cache (struct dax_device *dax_dev,bool wc) { -if (wc) -set_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); -else -clear_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); +assign_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags, wc); }EXPORT_SYMBOL_GPL (dax_write_cache); --2.51.0
Hi Alison,
Quoted 18 lines · Alison Schofield
Quoted 9 lines · Jonathan Cameron
Quoted 6 lines · Pankaj
Quoted 6 lines
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
From: Peng Fan <[email protected]>
Convert open-coded if/else with set_bit/clear_bit to the
assign_bitAPI.Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Peng Fan <[email protected]>Reviewed-by Pankaj Gupta <[email protected]>A bit marginal wrt to churn but a good change in general. Up to DAX maintainers on whether they want this type of small focused improvement.
Quoted 8 lines
I didn't see the improvement. When I peruse the file I see
set_bitandclear_bit, and now I see a couple of those obfuscated by a newassign_bit, needlessly.If Peng wants to come back around with a 'why' then I'd take another look. I shared my NAK story here:
Thanks for taking the time to explain, and for the link to your earlier reply - that was useful context.
This patch was done by a cocci rule.
sorry for not providing a justification for this particular conversion or making the intent clearer. Converting only some of the call sites leaves the file with a mix of styles.
Free to drop the patch.
Thanks
Peng
Quoted 33 lines
Quoted 32 lines
Reviewed-by Jonathan Cameron <[email protected]>Quoted 26 lines
Quoted 25 lines
--- drivers/dax/super.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/dax/super.c +1
-5@@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);void dax_write_cache (struct dax_device *dax_dev,bool wc) { -if (wc) -set_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); -else -clear_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); +assign_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags, wc); }EXPORT_SYMBOL_GPL (dax_write_cache); --2.51.0
Quoted 5 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Convert open-coded if/else with set_bit/clear_bit to the
assign_bitAPI.Signed-off-by Peng Fan <[email protected]>
Quoted 20 lines
--- drivers/dax/super.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/dax/super.c +1
-4@@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);void dax_write_cache (struct dax_device *dax_dev,bool wc) { -if (wc) -set_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); -else -clear_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); +assign_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags, wc); }EXPORT_SYMBOL_GPL (dax_write_cache);
Quoted 3 lines · Peng Fan (OSS)
From: Peng Fan <[email protected]>
Convert open-coded if/else with set_bit/clear_bit to the
assign_bitAPI.
NAK
See also:
https://lore.kernel.org/lkml/[email protected]/
Quoted 26 lines
Signed-off-by Peng Fan <[email protected]>--- drivers/dax/super.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/dax/super.c +1
-4@@ -385,10 +385,7 @@ EXPORT_SYMBOL_GPL(dax_flush);void dax_write_cache (struct dax_device *dax_dev,bool wc) { -if (wc) -set_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); -else -clear_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags); +assign_bit (DAXDEV_WRITE_CACHE , &dax_dev->flags, wc); }EXPORT_SYMBOL_GPL (dax_write_cache);Signature · 1 line
2.51.0