* [PATCH v2 0/8] Introduce strreplace
@ 2015-06-08 23:26 Rasmus Villemoes
2015-06-08 23:26 ` [PATCH v2 6/8] drivers/md/md.c: Use strreplace Rasmus Villemoes
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Rasmus Villemoes @ 2015-06-08 23:26 UTC (permalink / raw)
To: Andrew Morton, Greg Kroah-Hartman, Neil Brown, Theodore Ts'o,
Andreas Dilger, Steven Rostedt, Ingo Molnar
Cc: Joe Perches, Al Viro, Rasmus Villemoes, linux-kernel, linux-raid,
linux-ext4
Doing single-character substitution on an entire string is open-coded
in a few places, sometimes in a rather suboptimal way. This introduces
a trivial helper, strreplace, for this task along with a few example
conversions.
Andrew, can I get you to take 1/8 through the mm tree? I'm not sure
what the easiest path is for the remaining patches.
Rasmus Villemoes (8):
lib: string: Introduce strreplace
kernel/trace/trace_events_filter.c: Use strreplace
blktrace: use strreplace in do_blk_trace_setup
lib/kobject.c: Use strreplace
drivers/base/core.c: Use strreplace
drivers/md/md.c: Use strreplace
fs/jbd2/journal.c: Use strreplace
fs/ext4/super.c: Use strreplace in ext4_fill_super
drivers/base/core.c | 9 ++++-----
drivers/md/md.c | 4 +---
fs/ext4/super.c | 4 +---
fs/jbd2/journal.c | 10 ++--------
include/linux/string.h | 1 +
kernel/trace/blktrace.c | 6 ++----
kernel/trace/trace_events_filter.c | 5 ++---
lib/kobject.c | 13 +++++--------
lib/string.c | 17 +++++++++++++++++
9 files changed, 35 insertions(+), 34 deletions(-)
--
2.1.3
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2 6/8] drivers/md/md.c: Use strreplace
2015-06-08 23:26 [PATCH v2 0/8] Introduce strreplace Rasmus Villemoes
@ 2015-06-08 23:26 ` Rasmus Villemoes
2015-06-09 21:17 ` Neil Brown
2015-06-09 0:55 ` [PATCH v2 0/8] Introduce strreplace Theodore Ts'o
2015-06-09 21:02 ` Andrew Morton
2 siblings, 1 reply; 6+ messages in thread
From: Rasmus Villemoes @ 2015-06-08 23:26 UTC (permalink / raw)
To: Andrew Morton, Neil Brown
Cc: Joe Perches, Al Viro, Rasmus Villemoes, linux-raid, linux-kernel
There's no point in starting over when we meet a '/'. This also
eliminates a stack variable and a little .text.
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
v2: no changes.
drivers/md/md.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 27506302eb7a..2ea2f28551c5 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2024,7 +2024,6 @@ static int bind_rdev_to_array(struct md_rdev *rdev, struct mddev *mddev)
{
char b[BDEVNAME_SIZE];
struct kobject *ko;
- char *s;
int err;
/* prevent duplicates */
@@ -2070,8 +2069,7 @@ static int bind_rdev_to_array(struct md_rdev *rdev, struct mddev *mddev)
return -EBUSY;
}
bdevname(rdev->bdev,b);
- while ( (s=strchr(b, '/')) != NULL)
- *s = '!';
+ strreplace(b, '/', '!');
rdev->mddev = mddev;
printk(KERN_INFO "md: bind<%s>\n", b);
--
2.1.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2 6/8] drivers/md/md.c: Use strreplace
2015-06-08 23:26 ` [PATCH v2 6/8] drivers/md/md.c: Use strreplace Rasmus Villemoes
@ 2015-06-09 21:17 ` Neil Brown
0 siblings, 0 replies; 6+ messages in thread
From: Neil Brown @ 2015-06-09 21:17 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: Andrew Morton, Joe Perches, Al Viro, linux-raid, linux-kernel
On Tue, 9 Jun 2015 01:26:54 +0200
Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
> There's no point in starting over when we meet a '/'. This also
> eliminates a stack variable and a little .text.
>
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
> v2: no changes.
>
> drivers/md/md.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/md/md.c b/drivers/md/md.c
> index 27506302eb7a..2ea2f28551c5 100644
> --- a/drivers/md/md.c
> +++ b/drivers/md/md.c
> @@ -2024,7 +2024,6 @@ static int bind_rdev_to_array(struct md_rdev
> *rdev, struct mddev *mddev) {
> char b[BDEVNAME_SIZE];
> struct kobject *ko;
> - char *s;
> int err;
>
> /* prevent duplicates */
> @@ -2070,8 +2069,7 @@ static int bind_rdev_to_array(struct md_rdev
> *rdev, struct mddev *mddev) return -EBUSY;
> }
> bdevname(rdev->bdev,b);
> - while ( (s=strchr(b, '/')) != NULL)
> - *s = '!';
> + strreplace(b, '/', '!');
>
> rdev->mddev = mddev;
> printk(KERN_INFO "md: bind<%s>\n", b);
Acked-by: NeilBrown <neilb@suse.de>
I'm happy for Andrew to merge this.
Thanks,
NeilBrown
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/8] Introduce strreplace
2015-06-08 23:26 [PATCH v2 0/8] Introduce strreplace Rasmus Villemoes
2015-06-08 23:26 ` [PATCH v2 6/8] drivers/md/md.c: Use strreplace Rasmus Villemoes
@ 2015-06-09 0:55 ` Theodore Ts'o
2015-06-09 7:25 ` Rasmus Villemoes
2015-06-09 21:02 ` Andrew Morton
2 siblings, 1 reply; 6+ messages in thread
From: Theodore Ts'o @ 2015-06-09 0:55 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: Andrew Morton, Greg Kroah-Hartman, Neil Brown, Andreas Dilger,
Steven Rostedt, Ingo Molnar, Joe Perches, Al Viro, linux-kernel,
linux-raid, linux-ext4
On Tue, Jun 09, 2015 at 01:26:48AM +0200, Rasmus Villemoes wrote:
> Doing single-character substitution on an entire string is open-coded
> in a few places, sometimes in a rather suboptimal way. This introduces
> a trivial helper, strreplace, for this task along with a few example
> conversions.
>
> Andrew, can I get you to take 1/8 through the mm tree? I'm not sure
> what the easiest path is for the remaining patches.
This is not super urgent, right? So we could let 1/8 go into
mainline, and then the rest of the patches could go in the next
release. That would be the simplest, although it would drag out how
long it would take for strreplace to be used everywhere.
- Ted
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v2 0/8] Introduce strreplace
2015-06-09 0:55 ` [PATCH v2 0/8] Introduce strreplace Theodore Ts'o
@ 2015-06-09 7:25 ` Rasmus Villemoes
0 siblings, 0 replies; 6+ messages in thread
From: Rasmus Villemoes @ 2015-06-09 7:25 UTC (permalink / raw)
To: Theodore Ts'o
Cc: Andrew Morton, Greg Kroah-Hartman, Neil Brown, Andreas Dilger,
Steven Rostedt, Ingo Molnar, Joe Perches, Al Viro, linux-kernel,
linux-raid, linux-ext4
On Tue, Jun 09 2015, Theodore Ts'o <tytso@mit.edu> wrote:
> On Tue, Jun 09, 2015 at 01:26:48AM +0200, Rasmus Villemoes wrote:
>> Doing single-character substitution on an entire string is open-coded
>> in a few places, sometimes in a rather suboptimal way. This introduces
>> a trivial helper, strreplace, for this task along with a few example
>> conversions.
>>
>> Andrew, can I get you to take 1/8 through the mm tree? I'm not sure
>> what the easiest path is for the remaining patches.
>
> This is not super urgent, right?
Right, not urgent at all.
> So we could let 1/8 go into mainline, and then the rest of the patches
> could go in the next release. That would be the simplest, although it
> would drag out how long it would take for strreplace to be used
> everywhere.
Sure, though it would be a little weird to have a helper with no users
until 4.3 comes out.
Rasmus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/8] Introduce strreplace
2015-06-08 23:26 [PATCH v2 0/8] Introduce strreplace Rasmus Villemoes
2015-06-08 23:26 ` [PATCH v2 6/8] drivers/md/md.c: Use strreplace Rasmus Villemoes
2015-06-09 0:55 ` [PATCH v2 0/8] Introduce strreplace Theodore Ts'o
@ 2015-06-09 21:02 ` Andrew Morton
2 siblings, 0 replies; 6+ messages in thread
From: Andrew Morton @ 2015-06-09 21:02 UTC (permalink / raw)
To: Rasmus Villemoes
Cc: Greg Kroah-Hartman, Neil Brown, Theodore Ts'o, Andreas Dilger,
Steven Rostedt, Ingo Molnar, Joe Perches, Al Viro, linux-kernel,
linux-raid, linux-ext4
On Tue, 9 Jun 2015 01:26:48 +0200 Rasmus Villemoes <linux@rasmusvillemoes.dk> wrote:
> Doing single-character substitution on an entire string is open-coded
> in a few places, sometimes in a rather suboptimal way. This introduces
> a trivial helper, strreplace, for this task along with a few example
> conversions.
>
> Andrew, can I get you to take 1/8 through the mm tree? I'm not sure
> what the easiest path is for the remaining patches.
With this sort of thing I grab everything them feed the dependent
patches to maintainers after the base patch is upstream.
Or I merge the dependent patches myself if they were acked.
Or if the dependent patches are simple I'll just merge them anyway,
shrug. I'd say these fall into that category.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-06-09 21:17 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-08 23:26 [PATCH v2 0/8] Introduce strreplace Rasmus Villemoes
2015-06-08 23:26 ` [PATCH v2 6/8] drivers/md/md.c: Use strreplace Rasmus Villemoes
2015-06-09 21:17 ` Neil Brown
2015-06-09 0:55 ` [PATCH v2 0/8] Introduce strreplace Theodore Ts'o
2015-06-09 7:25 ` Rasmus Villemoes
2015-06-09 21:02 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).