diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-14 20:25:18 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-14 20:25:18 -0500 |
commit | a57cb1c1d7974c62a5c80f7869e35b492ace12cd (patch) | |
tree | 5a42ee9a668f171143464bc86013954c1bbe94ad /tools/testing/radix-tree/find_next_bit.c | |
parent | cf1b3341afab9d3ad02a76b3a619ea027dcf4e28 (diff) | |
parent | e1e14ab8411df344a17687821f8f78f0a1e73cbb (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton:
- a few misc things
- kexec updates
- DMA-mapping updates to better support networking DMA operations
- IPC updates
- various MM changes to improve DAX fault handling
- lots of radix-tree changes, mainly to the test suite. All leading up
to reimplementing the IDA/IDR code to be a wrapper layer over the
radix-tree. However the final trigger-pulling patch is held off for
4.11.
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (114 commits)
radix tree test suite: delete unused rcupdate.c
radix tree test suite: add new tag check
radix-tree: ensure counts are initialised
radix tree test suite: cache recently freed objects
radix tree test suite: add some more functionality
idr: reduce the number of bits per level from 8 to 6
rxrpc: abstract away knowledge of IDR internals
tpm: use idr_find(), not idr_find_slowpath()
idr: add ida_is_empty
radix tree test suite: check multiorder iteration
radix-tree: fix replacement for multiorder entries
radix-tree: add radix_tree_split_preload()
radix-tree: add radix_tree_split
radix-tree: add radix_tree_join
radix-tree: delete radix_tree_range_tag_if_tagged()
radix-tree: delete radix_tree_locate_item()
radix-tree: improve multiorder iterators
btrfs: fix race in btrfs_free_dummy_fs_info()
radix-tree: improve dump output
radix-tree: make radix_tree_find_next_bit more useful
...
Diffstat (limited to 'tools/testing/radix-tree/find_next_bit.c')
-rw-r--r-- | tools/testing/radix-tree/find_next_bit.c | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/tools/testing/radix-tree/find_next_bit.c b/tools/testing/radix-tree/find_next_bit.c deleted file mode 100644 index d1c2178bb2d4..000000000000 --- a/tools/testing/radix-tree/find_next_bit.c +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | /* find_next_bit.c: fallback find next bit implementation | ||
2 | * | ||
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | ||
4 | * Written by David Howells (dhowells@redhat.com) | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | #include <linux/bitops.h> | ||
14 | |||
15 | #define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) | ||
16 | |||
17 | /* | ||
18 | * Find the next set bit in a memory region. | ||
19 | */ | ||
20 | unsigned long find_next_bit(const unsigned long *addr, unsigned long size, | ||
21 | unsigned long offset) | ||
22 | { | ||
23 | const unsigned long *p = addr + BITOP_WORD(offset); | ||
24 | unsigned long result = offset & ~(BITS_PER_LONG-1); | ||
25 | unsigned long tmp; | ||
26 | |||
27 | if (offset >= size) | ||
28 | return size; | ||
29 | size -= result; | ||
30 | offset %= BITS_PER_LONG; | ||
31 | if (offset) { | ||
32 | tmp = *(p++); | ||
33 | tmp &= (~0UL << offset); | ||
34 | if (size < BITS_PER_LONG) | ||
35 | goto found_first; | ||
36 | if (tmp) | ||
37 | goto found_middle; | ||
38 | size -= BITS_PER_LONG; | ||
39 | result += BITS_PER_LONG; | ||
40 | } | ||
41 | while (size & ~(BITS_PER_LONG-1)) { | ||
42 | if ((tmp = *(p++))) | ||
43 | goto found_middle; | ||
44 | result += BITS_PER_LONG; | ||
45 | size -= BITS_PER_LONG; | ||
46 | } | ||
47 | if (!size) | ||
48 | return result; | ||
49 | tmp = *p; | ||
50 | |||
51 | found_first: | ||
52 | tmp &= (~0UL >> (BITS_PER_LONG - size)); | ||
53 | if (tmp == 0UL) /* Are any bits set? */ | ||
54 | return result + size; /* Nope. */ | ||
55 | found_middle: | ||
56 | return result + __ffs(tmp); | ||
57 | } | ||