summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-02-21Merge branch 'akpm/master'Stephen Rothwell
2013-02-21hlist-drop-the-node-parameter-from-iterators-mlx4-fixAndrew Morton
Cc: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21hlist-drop-the-node-parameter-from-iterators-fix-fix-fix-fix-fix-fixAndrew Morton
Reported-by: Wu Fengguang <fengguang.wu@intel.com> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Amir Vadai <amirv@mellanox.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21hlist-drop-the-node-parameter-from-iterators-redo-kvmAndrew Morton
Redo intrusive kvm changes Cc: Marcelo Tosatti <mtosatti@redhat.com> Cc: Gleb Natapov <gleb@redhat.com> Cc: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21hlist-drop-the-node-parameter-from-iterators-fix-fix-fixAndrew Morton
fix warnings Reported-by: Wu Fengguang <fengguang.wu@intel.com> Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21hlist-drop-the-node-parameter-from-iterators-fix-fixAndrew Morton
Cc: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21hlist-drop-the-node-parameter-from-iterators-fixAndrew Morton
Cc: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21hlist-drop-the-node-parameter-from-iterators-checkpatch-fixesAndrew Morton
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> ERROR: code indent should use tabs where possible #939: FILE: drivers/atm/atmtcp.c:270: + sk_for_each(s, head) {$ WARNING: please, no spaces at the start of a line #939: FILE: drivers/atm/atmtcp.c:270: + sk_for_each(s, head) {$ ERROR: space required before the open brace '{' #2295: FILE: fs/dlm/lowcomms.c:238: + hlist_for_each_entry_safe(con, n, &connection_hash[i], list){ WARNING: line over 80 characters #3070: FILE: include/linux/hashtable.h:122: + for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ WARNING: line over 80 characters #3084: FILE: include/linux/hashtable.h:132: +#define hash_for_each_rcu(name, bkt, obj, member) \ WARNING: line over 80 characters #3085: FILE: include/linux/hashtable.h:133: + for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ WARNING: line over 80 characters #3102: FILE: include/linux/hashtable.h:146: + for ((bkt) = 0, obj = NULL; obj == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ WARNING: line over 80 characters #3132: FILE: include/linux/hashtable.h:170: + hlist_for_each_entry_rcu(obj, &name[hash_min(key, HASH_BITS(name))], member) WARNING: line over 80 characters #3147: FILE: include/linux/hashtable.h:181: +#define hash_for_each_possible_safe(name, obj, tmp, member, key) \ WARNING: line over 80 characters #3148: FILE: include/linux/hashtable.h:182: + hlist_for_each_entry_safe(obj, tmp, &name[hash_min(key, HASH_BITS(name))], member) ERROR: Macros with complex values should be enclosed in parenthesis #3188: FILE: include/linux/list.h:669: +#define hlist_entry_safe(ptr, type, member) \ + (ptr) ? hlist_entry(ptr, type, member) : NULL WARNING: line over 80 characters #3204: FILE: include/linux/list.h:678: +#define hlist_for_each_entry(pos, head, member) \ WARNING: line over 80 characters #3205: FILE: include/linux/list.h:679: + for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member); \ WARNING: line over 80 characters #3206: FILE: include/linux/list.h:680: + pos; \ WARNING: line over 80 characters #3221: FILE: include/linux/list.h:688: +#define hlist_for_each_entry_continue(pos, member) \ WARNING: line over 80 characters #3222: FILE: include/linux/list.h:689: + for (pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member);\ WARNING: line over 80 characters #3223: FILE: include/linux/list.h:690: + pos; \ WARNING: line over 80 characters #3255: FILE: include/linux/list.h:709: +#define hlist_for_each_entry_safe(pos, n, head, member) \ WARNING: please, no space before tabs #3255: FILE: include/linux/list.h:709: +#define hlist_for_each_entry_safe(pos, n, head, member) ^I^I^I\$ WARNING: line over 80 characters #3256: FILE: include/linux/list.h:710: + for (pos = hlist_entry_safe((head)->first, typeof(*pos), member); \ WARNING: line over 80 characters #3257: FILE: include/linux/list.h:711: + pos && ({ n = pos->member.next; 1; }); \ WARNING: line over 80 characters #3297: FILE: include/linux/rculist.h:456: +#define hlist_for_each_entry_rcu(pos, head, member) \ WARNING: line over 80 characters #3298: FILE: include/linux/rculist.h:457: + for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\ WARNING: space prohibited between function name and open parenthesis '(' #3298: FILE: include/linux/rculist.h:457: + for (pos = hlist_entry_safe (rcu_dereference_raw(hlist_first_rcu(head)),\ WARNING: line over 80 characters #3299: FILE: include/linux/rculist.h:458: + typeof(*(pos)), member); \ WARNING: line over 80 characters #3300: FILE: include/linux/rculist.h:459: + pos; \ WARNING: line over 80 characters #3301: FILE: include/linux/rculist.h:460: + pos = hlist_entry_safe(rcu_dereference_raw(hlist_next_rcu( \ WARNING: line over 80 characters #3321: FILE: include/linux/rculist.h:473: +#define hlist_for_each_entry_rcu_bh(pos, head, member) \ WARNING: line over 80 characters #3322: FILE: include/linux/rculist.h:474: + for (pos = hlist_entry_safe(rcu_dereference_bh(hlist_first_rcu(head)), \ WARNING: line over 80 characters #3323: FILE: include/linux/rculist.h:475: + typeof(*(pos)), member); \ WARNING: line over 80 characters #3324: FILE: include/linux/rculist.h:476: + pos; \ WARNING: line over 80 characters #3325: FILE: include/linux/rculist.h:477: + pos = hlist_entry_safe(rcu_dereference_bh(hlist_next_rcu( \ WARNING: line over 80 characters #3340: FILE: include/linux/rculist.h:485: +#define hlist_for_each_entry_continue_rcu(pos, member) \ WARNING: line over 80 characters #3341: FILE: include/linux/rculist.h:486: + for (pos = hlist_entry_safe(rcu_dereference((pos)->member.next), \ WARNING: line over 80 characters #3342: FILE: include/linux/rculist.h:487: + typeof(*(pos)), member); \ WARNING: line over 80 characters #3343: FILE: include/linux/rculist.h:488: + pos; \ WARNING: line over 80 characters #3344: FILE: include/linux/rculist.h:489: + pos = hlist_entry_safe(rcu_dereference((pos)->member.next), \ ERROR: code indent should use tabs where possible #3345: FILE: include/linux/rculist.h:490: +^I ^I^Itypeof(*(pos)), member))$ WARNING: please, no space before tabs #3345: FILE: include/linux/rculist.h:490: +^I ^I^Itypeof(*(pos)), member))$ WARNING: line over 80 characters #3359: FILE: include/linux/rculist.h:497: +#define hlist_for_each_entry_continue_rcu_bh(pos, member) \ WARNING: line over 80 characters #3360: FILE: include/linux/rculist.h:498: + for (pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next), \ WARNING: line over 80 characters #3361: FILE: include/linux/rculist.h:499: + typeof(*(pos)), member); \ WARNING: line over 80 characters #3362: FILE: include/linux/rculist.h:500: + pos; \ WARNING: line over 80 characters #3363: FILE: include/linux/rculist.h:501: + pos = hlist_entry_safe(rcu_dereference_bh((pos)->member.next), \ ERROR: code indent should use tabs where possible #3364: FILE: include/linux/rculist.h:502: +^I ^I^Itypeof(*(pos)), member))$ WARNING: please, no space before tabs #3364: FILE: include/linux/rculist.h:502: +^I ^I^Itypeof(*(pos)), member))$ ERROR: do not use C99 // comments #3817: FILE: kernel/smpboot.c:134: + //BUG_ON(td->cpu != smp_processor_id()); ERROR: do not use C99 // comments #4452: FILE: net/9p/trans_virtio.c:658: + //.zc_request = p9_virtio_zc_request, WARNING: line over 80 characters #7049: FILE: net/decnet/af_decnet.c:418: + sk_for_each(sk, &dn_sk_hash[le16_to_cpu(cb->dst_port) & DN_SK_HASH_MASK]) { WARNING: space prohibited between function name and open parenthesis '(' #7696: FILE: net/ipv4/raw.c:123: + sk_for_each_from (sk) { ERROR: spaces required around that '=' (ctx:VxV) #7697: FILE: net/ipv4/raw.c:124: + struct inet_sock *inet=inet_sk(sk); ^ WARNING: line over 80 characters #7698: FILE: net/ipv4/raw.c:125: + if (net_eq(sock_net(sk), net) && inet->inet_num == num && !(inet->inet_daddr && inet->inet_daddr != raddr) && !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) && !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) WARNING: space prohibited between function name and open parenthesis '(' #8085: FILE: net/ipv6/raw.c:100: + sk_for_each_from (sk) ERROR: spaces required around that '=' (ctx:VxV) #8087: FILE: net/ipv6/raw.c:102: + struct ipv6_pinfo *np=inet6_sk(sk); ^ WARNING: line over 80 characters #8090: FILE: net/ipv6/raw.c:105: + if (!ipv6_addr_any(&np->daddr) && !ipv6_addr_equal(&np->daddr, rmt_addr)) WARNING: line over 80 characters #8092: FILE: net/ipv6/raw.c:107: + if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) WARNING: Too many leading tabs - consider code refactoring #8092: FILE: net/ipv6/raw.c:107: + if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) WARNING: line over 80 characters #8094: FILE: net/ipv6/raw.c:109: + if (!ipv6_addr_any(&np->rcv_saddr)) { WARNING: Too many leading tabs - consider code refactoring #8094: FILE: net/ipv6/raw.c:109: + if (!ipv6_addr_any(&np->rcv_saddr)) { WARNING: line over 80 characters #8095: FILE: net/ipv6/raw.c:110: + if (ipv6_addr_equal(&np->rcv_saddr, loc_addr)) WARNING: Too many leading tabs - consider code refactoring #8095: FILE: net/ipv6/raw.c:110: + if (ipv6_addr_equal(&np->rcv_saddr, loc_addr)) WARNING: line over 80 characters #8096: FILE: net/ipv6/raw.c:111: + goto found; WARNING: line over 80 characters #8097: FILE: net/ipv6/raw.c:112: + if (is_multicast && inet6_mc_check(sk, loc_addr, rmt_addr)) WARNING: Too many leading tabs - consider code refactoring #8097: FILE: net/ipv6/raw.c:112: + if (is_multicast && inet6_mc_check(sk, loc_addr, rmt_addr)) WARNING: line over 80 characters #8098: FILE: net/ipv6/raw.c:113: + goto found; WARNING: line over 80 characters #8099: FILE: net/ipv6/raw.c:114: + continue; WARNING: line over 80 characters #8101: FILE: net/ipv6/raw.c:116: + goto found; WARNING: line over 80 characters #8413: FILE: net/l2tp/l2tp_core.c:285: + hlist_for_each_entry(session, &tunnel->session_hlist[hash], hlist) { WARNING: line over 80 characters #8427: FILE: net/l2tp/l2tp_core.c:310: + hlist_for_each_entry_rcu(session, &pn->l2tp_session_hlist[hash], global_hlist) { total: 9 errors, 60 warnings, 9471 lines checked NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or scripts/cleanfile ./patches/hlist-drop-the-node-parameter-from-iterators.patch has style problems, please review. If any of these errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. Please run checkpatch prior to sending patches Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Peter Senna Tschudin <peter.senna@gmail.com> Cc: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21hlist-drop-the-node-parameter-from-iterators-fix-fix-fix-fix-fixAndrew Morton
drop bogus hunk from net/ipv6/raw.c Cc: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21hlist-drop-the-node-parameter-from-iterators-fix-fix-fix-fixAndrew Morton
drop bogus change from net/ipv4/raw.c Cc: Sasha Levin <sasha.levin@oracle.com> Cc: Tejun Heo <tj@kernel.org> Cc: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21hlist: drop the node parameter from iteratorsSasha Levin
I'm not sure why, but the hlist for each entry iterators were conceived list_for_each_entry(pos, head, member) The hlist ones were greedy and wanted an extra parameter: hlist_for_each_entry(tpos, pos, head, member) Why did they need an extra pos parameter? I'm not quite sure. Not only they don't really need it, it also prevents the iterator from looking exactly like the list iterator, which is unfortunate. Besides the semantic patch, there was some manual work required: - Fix up the actual hlist iterators in linux/list.h - Fix up the declaration of other iterators based on the hlist ones. - A very small amount of places were using the 'node' parameter, this was modified to use 'obj->member' instead. - Coccinelle didn't handle the hlist_for_each_entry_safe iterator properly, so those had to be fixed up manually. The semantic patch which is mostly the work of Peter Senna Tschudin is here: @@ iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host; type T; expression a,c,d,e; identifier b; statement S; @@ -T b; <+... when != b ( hlist_for_each_entry(a, - b, c, d) S | hlist_for_each_entry_continue(a, - b, c) S | hlist_for_each_entry_from(a, - b, c) S | hlist_for_each_entry_rcu(a, - b, c, d) S | hlist_for_each_entry_rcu_bh(a, - b, c, d) S | hlist_for_each_entry_continue_rcu_bh(a, - b, c) S | for_each_busy_worker(a, c, - b, d) S | ax25_uid_for_each(a, - b, c) S | ax25_for_each(a, - b, c) S | inet_bind_bucket_for_each(a, - b, c) S | sctp_for_each_hentry(a, - b, c) S | sk_for_each(a, - b, c) S | sk_for_each_rcu(a, - b, c) S | sk_for_each_from -(a, b) +(a) S + sk_for_each_from(a) S | sk_for_each_safe(a, - b, c, d) S | sk_for_each_bound(a, - b, c) S | hlist_for_each_entry_safe(a, - b, c, d, e) S | hlist_for_each_entry_continue_rcu(a, - b, c) S | nr_neigh_for_each(a, - b, c) S | nr_neigh_for_each_safe(a, - b, c, d) S | nr_node_for_each(a, - b, c) S | nr_node_for_each_safe(a, - b, c, d) S | - for_each_gfn_sp(a, c, d, b) S + for_each_gfn_sp(a, c, d) S | - for_each_gfn_indirect_valid_sp(a, c, d, b) S + for_each_gfn_indirect_valid_sp(a, c, d) S | for_each_host(a, - b, c) S | for_each_host_safe(a, - b, c, d) S | for_each_mesh_entry(a, - b, c, d) S ) ...+> Tested-by: Peter Senna Tschudin <peter.senna@gmail.com> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21kcmp: make it depend on CHECKPOINT_RESTORECyrill Gorcunov
Since kcmp syscall has been implemented (initially on x86 architecture) a number of other archs wire it up as well: xtensa, sparc, sh, s390, mips, microblaze, m68k (not taking into account those who uses <asm-generic/unistd.h> for syscall numbers definitions). But the Makefile, which turns kcmp.o generation on still depends on former config-x86. Thus get rid of this limitation and make kcmp.o depend on CHECKPOINT_RESTORE option. Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Pavel Emelyanov <xemul@parallels.com> Cc: Andrey Vagin <avagin@openvz.org> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21selftests-add-a-simple-doc-fixAndrew Morton
move from Documentation to tools/testing/selftests/README.txt Cc: Dave Young <dyoung@redhat.com> Cc: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21selftests: add a simple docJeremy Kerr
This change adds a little documentation to the tests under tools/testing/selftests/, based on akpm's explanation. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Cc: Dave Young <dyoung@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21tools/testing/selftests/Makefile: rearrange targetsAndrew Morton
Do it one-per-line to reduce patch conflict pain. Cc: Dave Young <dyoung@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21selftests/efivarfs: add create-read testJeremy Kerr
Test that reads from a newly-created efivarfs file (with no data written) will return EOF. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Cc: Matt Fleming <matt.fleming@intel.com> Cc: Lingzhu Xiang <lxiang@redhat.com> Cc: Dave Young <dyoung@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21selftests/efivarfs: add empty file creation testJeremy Kerr
Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Cc: Matt Fleming <matt.fleming@intel.com> Cc: Lingzhu Xiang <lxiang@redhat.com> Cc: Dave Young <dyoung@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21selftests-add-tests-for-efivarfs-fix-fixAndrew Morton
Cc: Dave Young <dyoung@redhat.com> Cc: Jeremy Kerr <jk@ozlabs.org> Cc: Lingzhu Xiang <lxiang@redhat.com> Cc: Matt Fleming <matt.fleming@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21selftests-add-tests-for-efivarfs-fixAndrew Morton
Cc: Jeremy Kerr <jk@ozlabs.org> Cc: Matt Fleming <matt.fleming@intel.com> Cc: Lingzhu Xiang <lxiang@redhat.com> Cc: Dave Young <dyoung@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21selftests: add tests for efivarfsJeremy Kerr
This change adds a few initial efivarfs tests to the tools/testing/selftests directory. The open-unlink test is based on code from Lingzhu Xiang. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Cc: Matt Fleming <matt.fleming@intel.com> Cc: Lingzhu Xiang <lxiang@redhat.com> Cc: Dave Young <dyoung@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21kfifo: fix kfifo_alloc() and kfifo_init()Stefani Seibold
Fix kfifo_alloc() and kfifo_init() to alloc at least the requested number of elements. Since the kfifo operates on power of 2 the request size will be rounded up to the next power of two. Signed-off-by: Stefani Seibold <stefani@seibold.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21kfifo: move kfifo.c from kernel/ to lib/Stefani Seibold
Move kfifo.c from kernel/ to lib/ Signed-off-by: Stefani Seibold <stefani@seibold.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21arch Kconfig: centralise CONFIG_ARCH_NO_VIRT_TO_BUSStephen Rothwell
Change it to CONFIG_HAVE_VIRT_TO_BUS and set it in all architecures that already provide virt_to_bus(). Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Reviewed-by: James Hogan <james.hogan@imgtec.com> Cc: Bjorn Helgaas <bhelgaas@google.com> Cc: H Hartley Sweeten <hartleys@visionengravers.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: "David S. Miller" <davem@davemloft.net> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio: v3: fix kioctx not being freed after cancellation at exit timeBenjamin LaHaise
v3 corrects a typo in v2 of this patch. The wrong version of the patch was copied over and misspelled ctx in the first hunk. A known good tree with this patch is at git://git.kvack.org/~bcrl/linux-next-20130213.git-v3 . Signed-off-by: Benjamin LaHaise <bcrl@kvack.org> Cc: Kent Overstreet <koverstreet@google.com> Cc: Josh Boyer <jwboyer@redhat.com> Cc: Zach Brown <zab@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio: fix kioctx not being freed after cancellation at exit timeBenjamin LaHaise
The recent changes overhauling fs/aio.c introduced a bug that results in the kioctx not being freed when outstanding kiocbs are cancelled at exit_aio() time. Specifically, a kiocb that is cancelled has its completion events discarded by batch_complete_aio(), which then fails to wake up the process stuck in free_ioctx(). Fix this by removing the event suppression in batch_complete_aio() and modify the wait_event() condition in free_ioctx() appropriately. This patch was tested with the cancel operation in the thread based code posted yesterday. Signed-off-by: Benjamin LaHaise <bcrl@kvack.org> Cc: Kent Overstreet <koverstreet@google.com> Cc: Josh Boyer <jwboyer@redhat.com> Cc: Zach Brown <zab@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio: correct calculation of available eventsBenjamin LaHaise
When the number of available events in the ring buffer is calculated, the avail calculation is incorrect when head == tail. This is harmless in aio_read_events_ring(), but in free_ioctx() leads to the subsequent WARN_ON(atomic_read(&ctx->reqs_available) > ctx->nr). Correct this. Signed-off-by: Benjamin LaHaise <bcrl@kvack.org> Reviewed-by: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio: document, clarify aio_read_events() and shadow_tailKent Overstreet
Signed-off-by: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio: fix aio_read_events_ring() typesKent Overstreet
Signed-off-by: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21mtip32xx: convert to batch completionKent Overstreet
Signed-off-by: Kent Overstreet <koverstreet@google.com> Cc: Zach Brown <zab@redhat.com> Cc: Felipe Balbi <balbi@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Jens Axboe <axboe@kernel.dk> Cc: Asai Thambi S P <asamymuthupa@micron.com> Cc: Selvan Mani <smani@micron.com> Cc: Sam Bradshaw <sbradshaw@micron.com> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21virtio-blk: convert to batch completionKent Overstreet
Signed-off-by: Kent Overstreet <koverstreet@google.com> Cc: Zach Brown <zab@redhat.com> Cc: Felipe Balbi <balbi@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Jens Axboe <axboe@kernel.dk> Cc: Asai Thambi S P <asamymuthupa@micron.com> Cc: Selvan Mani <smani@micron.com> Cc: Sam Bradshaw <sbradshaw@micron.com> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio: Fix a null pointer deref in batch_complete_aioKent Overstreet
The batch completion code was trying to be a bit too clever, and skip checking ctx where it couldn't be NULL - but that broke if a kiocb had been cancelled. Move the check to kioctx_ring_unlock(). Signed-off-by: Kent Overstreet <koverstreet@google.com> Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21block-aio-batch-completion-for-bios-kiocbs-fix-fix-fix-fix-fix-fixAndrew Morton
fix tracepoint in batch_complete() Cc: Kent Overstreet <koverstreet@google.com> Cc: Minchan Kim <minchan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21Fix build error due to bio_endio_batchMinchan Kim
This patch fixes build error of recent mmotm. Signed-off-by: Minchan Kim <minchan@kernel.org> Cc: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21block-aio-batch-completion-for-bios-kiocbs-fix-fix-fix-fixKent Overstreet
Fix broken build when CONFIG_BLOCK=n by pulling common stuff out into a new header. Signed-off-by: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21block-aio-batch-completion-for-bios-kiocbs-fix-fix-fixAndrew Morton
fix warnings Cc: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21block-aio-batch-completion-for-bios-kiocbs-fix-fixAndrew Morton
fs/aio.c needs bio.h, move bio_endio_batch() declaration somewhere rational Cc: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21block-aio-batch-completion-for-bios-kiocbs-fixAndrew Morton
fs/aio.c: In function 'kioctx_ring_put': fs/aio.c:636: warning: cast from pointer to integer of different size Cc: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21block, aio: batch completion for bios/kiocbsKent Overstreet
When completing a kiocb, there's some fixed overhead from touching the kioctx's ring buffer the kiocb belongs to. Some newer high end block devices can complete multiple IOs per interrupt, much like many network interfaces have been for some time. This plumbs through infrastructure so we can take advantage of multiple completions at the interrupt level, and complete multiple kiocbs at the same time. Drivers have to be converted to take advantage of this, but it's a simple change and the next patches will convert a few drivers. To use it, an interrupt handler (or any code that completes bios or requests) declares and initializes a struct batch_complete: struct batch_complete batch; batch_complete_init(&batch); Then, instead of calling bio_endio(), it calls bio_endio_batch(bio, err, &batch). This just adds the bio to a list in the batch_complete. At the end, it calls batch_complete(&batch); This completes all the bios all at once, building up a list of kiocbs; then the list of kiocbs are completed all at once. Also, in order to batch up the kiocbs we have to add a different bio_endio function to struct bio, that takes a pointer to the batch_complete - this patch converts the dio code's bio_endio function. In order to avoid changing every bio_endio function in the kernel (there are many), we currently use a union and a flag to indicate what kind of bio endio function to call. This is admittedly a hack, but should suffice for now. For batching to work through say md or dm devices, the md/dm bio_endio functions would have to be converted, much like the dio code. That is left for future patches. Signed-off-by: Kent Overstreet <koverstreet@google.com> Cc: Zach Brown <zab@redhat.com> Cc: Felipe Balbi <balbi@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Jens Axboe <axboe@kernel.dk> Cc: Asai Thambi S P <asamymuthupa@micron.com> Cc: Selvan Mani <smani@micron.com> Cc: Sam Bradshaw <sbradshaw@micron.com> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio-kill-ki_retry-fix-fixKent Overstreet
The "aio: kill ki-retry" patch was assuming that we didn't touch struct kiocb after passing it off to something that would call aio_complete() - which was wrong. So, revert the refcounting changes. Signed-off-by: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio-kill-ki_retry-fixAndrew Morton
use fmode_t in aio_run_iocb() Cc: Kent Overstreet <koverstreet@google.com> Reported-by: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio: kill ki_retryKent Overstreet
Thanks to Zach Brown's work to rip out the retry infrastructure, we don't need this anymore - ki_retry was only called right after the kiocb was initialized. This also refactors and trims some duplicated code, as well as cleaning up the refcounting/error handling a bit. Signed-off-by: Kent Overstreet <koverstreet@google.com> Cc: Zach Brown <zab@redhat.com> Cc: Felipe Balbi <balbi@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Jens Axboe <axboe@kernel.dk> Cc: Asai Thambi S P <asamymuthupa@micron.com> Cc: Selvan Mani <smani@micron.com> Cc: Sam Bradshaw <sbradshaw@micron.com> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio: kill ki_keyKent Overstreet
ki_key wasn't actually used for anything previously - it was always 0. Drop it to trim struct kiocb a bit. Signed-off-by: Kent Overstreet <koverstreet@google.com> Cc: Zach Brown <zab@redhat.com> Cc: Felipe Balbi <balbi@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Jens Axboe <axboe@kernel.dk> Cc: Asai Thambi S P <asamymuthupa@micron.com> Cc: Selvan Mani <smani@micron.com> Cc: Sam Bradshaw <sbradshaw@micron.com> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio-dont-include-aioh-in-schedh-fix-3-fix-fixAndrew Morton
fix build Reported-by: Fengguang Wu <fengguang.wu@intel.com> Cc: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio-dont-include-aioh-in-schedh-fix-3-fixAndrew Morton
fix build Reported-by: Fengguang Wu <fengguang.wu@intel.com> Cc: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio-dont-include-aioh-in-schedh-fix-3Andrew Morton
Cc: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio-dont-include-aioh-in-schedh-fix-fixAndrew Morton
Cc: Kent Overstreet <koverstreet@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio-dont-include-aioh-in-schedh-fixAndrew Morton
Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Asai Thambi S P <asamymuthupa@micron.com> Cc: Benjamin LaHaise <bcrl@kvack.org> Cc: Felipe Balbi <balbi@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Joel Becker <jlbec@evilplan.org> Cc: Kent Overstreet <koverstreet@google.com> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Sam Bradshaw <sbradshaw@micron.com> Cc: Selvan Mani <smani@micron.com> Cc: Zach Brown <zab@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio: don't include aio.h in sched.hKent Overstreet
Faster kernel compiles by way of fewer unnecessary includes. Signed-off-by: Kent Overstreet <koverstreet@google.com> Cc: Zach Brown <zab@redhat.com> Cc: Felipe Balbi <balbi@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Jens Axboe <axboe@kernel.dk> Cc: Asai Thambi S P <asamymuthupa@micron.com> Cc: Selvan Mani <smani@micron.com> Cc: Sam Bradshaw <sbradshaw@micron.com> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio: use xchg() instead of completion_lockKent Overstreet
So, for sticking kiocb completions on the kioctx ringbuffer, we need a lock - it unfortunately can't be lockless. When the kioctx is shared between threads on different cpus and the rate of completions is high, this lock sees quite a bit of contention - in terms of cacheline contention it's the hottest thing in the aio subsystem. That means, with a regular spinlock, we're going to take a cache miss to grab the lock, then another cache miss when we touch the data the lock protects - if it's on the same cacheline as the lock, other cpus spinning on the lock are going to be pulling it out from under us as we're using it. So, we use an old trick to get rid of this second forced cache miss - make the data the lock protects be the lock itself, so we grab them both at once. Signed-off-by: Kent Overstreet <koverstreet@google.com> Cc: Zach Brown <zab@redhat.com> Cc: Felipe Balbi <balbi@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Jens Axboe <axboe@kernel.dk> Cc: Asai Thambi S P <asamymuthupa@micron.com> Cc: Selvan Mani <smani@micron.com> Cc: Sam Bradshaw <sbradshaw@micron.com> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2013-02-21aio: percpu ioctx refcountKent Overstreet
This just converts the ioctx refcount to the new generic dynamic percpu refcount code. Signed-off-by: Kent Overstreet <koverstreet@google.com> Cc: Zach Brown <zab@redhat.com> Cc: Felipe Balbi <balbi@ti.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Jens Axboe <axboe@kernel.dk> Cc: Asai Thambi S P <asamymuthupa@micron.com> Cc: Selvan Mani <smani@micron.com> Cc: Sam Bradshaw <sbradshaw@micron.com> Cc: Jeff Moyer <jmoyer@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>