From 8359f689e23a607ec6758737551045997848ac75 Mon Sep 17 00:00:00 2001 From: "zhangwei(Jovi)" Date: Tue, 30 Apr 2013 15:28:39 -0700 Subject: kernel/relay.c: remove unused function argument actor Currently argument `actor' is never used in the relay reading path, so remove it. Signed-off-by: zhangwei(Jovi) Cc: Jens Axboe Cc: Al Viro Cc: Eric Dumazet Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/relay.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'kernel/relay.c') diff --git a/kernel/relay.c b/kernel/relay.c index 01ab081ac53a..d21006c4a3cc 100644 --- a/kernel/relay.c +++ b/kernel/relay.c @@ -1099,8 +1099,7 @@ static size_t relay_file_read_end_pos(struct rchan_buf *buf, static int subbuf_read_actor(size_t read_start, struct rchan_buf *buf, size_t avail, - read_descriptor_t *desc, - read_actor_t actor) + read_descriptor_t *desc) { void *from; int ret = 0; @@ -1121,15 +1120,13 @@ static int subbuf_read_actor(size_t read_start, typedef int (*subbuf_actor_t) (size_t read_start, struct rchan_buf *buf, size_t avail, - read_descriptor_t *desc, - read_actor_t actor); + read_descriptor_t *desc); /* * relay_file_read_subbufs - read count bytes, bridging subbuf boundaries */ static ssize_t relay_file_read_subbufs(struct file *filp, loff_t *ppos, subbuf_actor_t subbuf_actor, - read_actor_t actor, read_descriptor_t *desc) { struct rchan_buf *buf = filp->private_data; @@ -1150,7 +1147,7 @@ static ssize_t relay_file_read_subbufs(struct file *filp, loff_t *ppos, break; avail = min(desc->count, avail); - ret = subbuf_actor(read_start, buf, avail, desc, actor); + ret = subbuf_actor(read_start, buf, avail, desc); if (desc->error < 0) break; @@ -1174,8 +1171,7 @@ static ssize_t relay_file_read(struct file *filp, desc.count = count; desc.arg.buf = buffer; desc.error = 0; - return relay_file_read_subbufs(filp, ppos, subbuf_read_actor, - NULL, &desc); + return relay_file_read_subbufs(filp, ppos, subbuf_read_actor, &desc); } static void relay_consume_bytes(struct rchan_buf *rbuf, int bytes_consumed) -- cgit v1.2.1 From 536b39ecf1b52ab71c2c126db0137611b9e1a4d4 Mon Sep 17 00:00:00 2001 From: "zhangwei(Jovi)" Date: Tue, 30 Apr 2013 15:28:40 -0700 Subject: kernel/relay.c: move FIX_SIZE macro into relay.c It's better to place FIX_SIZE macro in relay.c, instead of relay.h Signed-off-by: zhangwei(Jovi) Cc: Jens Axboe Cc: Al Viro Cc: Eric Dumazet Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/relay.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'kernel/relay.c') diff --git a/kernel/relay.c b/kernel/relay.c index d21006c4a3cc..4c2959b6c34d 100644 --- a/kernel/relay.c +++ b/kernel/relay.c @@ -550,6 +550,9 @@ static int __cpuinit relay_hotcpu_callback(struct notifier_block *nb, return NOTIFY_OK; } +/* Needs a _much_ better name... */ +#define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE) + /** * relay_open - create a new relay channel * @base_filename: base name of files to create, %NULL for buffering only -- cgit v1.2.1 From a05342cbd62b7f6dacb8d71683d799f5e5e694b8 Mon Sep 17 00:00:00 2001 From: "zhangwei(Jovi)" Date: Tue, 30 Apr 2013 15:28:41 -0700 Subject: relay: use macro PAGE_ALIGN instead of FIX_SIZE Macro FIX_SIZE is same as PAGE_ALIGN at present, so use PAGE_ALIGN instead. Thanks Andrew found this. Signed-off-by: zhangwei(Jovi) Cc: Jens Axboe Cc: Al Viro Cc: Eric Dumazet Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/relay.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'kernel/relay.c') diff --git a/kernel/relay.c b/kernel/relay.c index 4c2959b6c34d..eef0d113b79e 100644 --- a/kernel/relay.c +++ b/kernel/relay.c @@ -550,9 +550,6 @@ static int __cpuinit relay_hotcpu_callback(struct notifier_block *nb, return NOTIFY_OK; } -/* Needs a _much_ better name... */ -#define FIX_SIZE(x) ((((x) - 1) & PAGE_MASK) + PAGE_SIZE) - /** * relay_open - create a new relay channel * @base_filename: base name of files to create, %NULL for buffering only @@ -591,7 +588,7 @@ struct rchan *relay_open(const char *base_filename, chan->version = RELAYFS_CHANNEL_VERSION; chan->n_subbufs = n_subbufs; chan->subbuf_size = subbuf_size; - chan->alloc_size = FIX_SIZE(subbuf_size * n_subbufs); + chan->alloc_size = PAGE_ALIGN(subbuf_size * n_subbufs); chan->parent = parent; chan->private_data = private_data; if (base_filename) { -- cgit v1.2.1