diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-05 14:09:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-05 14:09:16 -0400 |
commit | 11126c611e10abb18b6f1ed0300c0548c3906b54 (patch) | |
tree | 246227ad730c1e68f5a9c03db57cd4592abe7687 /kernel/resource.c | |
parent | 67966e088b0c7dc926f4ce19565ebf208e18d058 (diff) | |
parent | 33e2a4227ddff7c18921ac175fae3ab0e3ff8a76 (diff) |
Merge branch 'akpm' (Andrew's patch-bomb)
Merge misc patches from Andrew Morton:
"The MM tree is rather stuck while I wait to find out what the heck is
happening with sched/numa. Probably I'll need to route around all the
code which was added to -next, sigh.
So this is "everything else", or at least most of it - other small
bits are still awaiting resolutions of various kinds."
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (180 commits)
lib/decompress.c add __init to decompress_method and data
kernel/resource.c: fix stack overflow in __reserve_region_with_split()
omfs: convert to use beXX_add_cpu()
taskstats: cgroupstats_user_cmd() may leak on error
aoe: update aoe-internal version number to 50
aoe: update documentation to better reflect aoe-plus-udev usage
aoe: remove unused code
aoe: make dynamic block minor numbers the default
aoe: update and specify AoE address guards and error messages
aoe: retain static block device numbers for backwards compatibility
aoe: support more AoE addresses with dynamic block device minor numbers
aoe: update documentation with new URL and VM settings reference
aoe: update copyright year in touched files
aoe: update internal version number to 49
aoe: remove unused code and add cosmetic improvements
aoe: increase net_device reference count while using it
aoe: associate frames with the AoE storage target
aoe: disallow unsupported AoE minor addresses
aoe: do revalidation steps in order
aoe: failover remote interface based on aoe_deadsecs parameter
...
Diffstat (limited to 'kernel/resource.c')
-rw-r--r-- | kernel/resource.c | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/kernel/resource.c b/kernel/resource.c index 34d45886ee84..73f35d4b30b9 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -763,6 +763,7 @@ static void __init __reserve_region_with_split(struct resource *root, | |||
763 | struct resource *parent = root; | 763 | struct resource *parent = root; |
764 | struct resource *conflict; | 764 | struct resource *conflict; |
765 | struct resource *res = kzalloc(sizeof(*res), GFP_ATOMIC); | 765 | struct resource *res = kzalloc(sizeof(*res), GFP_ATOMIC); |
766 | struct resource *next_res = NULL; | ||
766 | 767 | ||
767 | if (!res) | 768 | if (!res) |
768 | return; | 769 | return; |
@@ -772,21 +773,46 @@ static void __init __reserve_region_with_split(struct resource *root, | |||
772 | res->end = end; | 773 | res->end = end; |
773 | res->flags = IORESOURCE_BUSY; | 774 | res->flags = IORESOURCE_BUSY; |
774 | 775 | ||
775 | conflict = __request_resource(parent, res); | 776 | while (1) { |
776 | if (!conflict) | ||
777 | return; | ||
778 | 777 | ||
779 | /* failed, split and try again */ | 778 | conflict = __request_resource(parent, res); |
780 | kfree(res); | 779 | if (!conflict) { |
780 | if (!next_res) | ||
781 | break; | ||
782 | res = next_res; | ||
783 | next_res = NULL; | ||
784 | continue; | ||
785 | } | ||
781 | 786 | ||
782 | /* conflict covered whole area */ | 787 | /* conflict covered whole area */ |
783 | if (conflict->start <= start && conflict->end >= end) | 788 | if (conflict->start <= res->start && |
784 | return; | 789 | conflict->end >= res->end) { |
790 | kfree(res); | ||
791 | WARN_ON(next_res); | ||
792 | break; | ||
793 | } | ||
794 | |||
795 | /* failed, split and try again */ | ||
796 | if (conflict->start > res->start) { | ||
797 | end = res->end; | ||
798 | res->end = conflict->start - 1; | ||
799 | if (conflict->end < end) { | ||
800 | next_res = kzalloc(sizeof(*next_res), | ||
801 | GFP_ATOMIC); | ||
802 | if (!next_res) { | ||
803 | kfree(res); | ||
804 | break; | ||
805 | } | ||
806 | next_res->name = name; | ||
807 | next_res->start = conflict->end + 1; | ||
808 | next_res->end = end; | ||
809 | next_res->flags = IORESOURCE_BUSY; | ||
810 | } | ||
811 | } else { | ||
812 | res->start = conflict->end + 1; | ||
813 | } | ||
814 | } | ||
785 | 815 | ||
786 | if (conflict->start > start) | ||
787 | __reserve_region_with_split(root, start, conflict->start-1, name); | ||
788 | if (conflict->end < end) | ||
789 | __reserve_region_with_split(root, conflict->end+1, end, name); | ||
790 | } | 816 | } |
791 | 817 | ||
792 | void __init reserve_region_with_split(struct resource *root, | 818 | void __init reserve_region_with_split(struct resource *root, |