diff options
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/Makefile | 1 | ||||
| -rw-r--r-- | fs/aio.c | 9 | ||||
| -rw-r--r-- | fs/buffer.c | 4 | ||||
| -rw-r--r-- | fs/char_dev.c | 2 | ||||
| -rw-r--r-- | fs/ext3/balloc.c | 135 | ||||
| -rw-r--r-- | fs/ext3/file.c | 4 | ||||
| -rw-r--r-- | fs/ext3/super.c | 3 | ||||
| -rw-r--r-- | fs/fat/cache.c | 2 | ||||
| -rw-r--r-- | fs/fat/inode.c | 21 | ||||
| -rw-r--r-- | fs/freevxfs/vxfs.h | 1 | ||||
| -rw-r--r-- | fs/freevxfs/vxfs_bmap.c | 2 | ||||
| -rw-r--r-- | fs/freevxfs/vxfs_fshead.c | 11 | ||||
| -rw-r--r-- | fs/freevxfs/vxfs_kcompat.h | 49 | ||||
| -rw-r--r-- | fs/freevxfs/vxfs_lookup.c | 8 | ||||
| -rw-r--r-- | fs/freevxfs/vxfs_olt.c | 10 | ||||
| -rw-r--r-- | fs/freevxfs/vxfs_subr.c | 1 | ||||
| -rw-r--r-- | fs/freevxfs/vxfs_super.c | 7 | ||||
| -rw-r--r-- | fs/ioprio.c | 172 | ||||
| -rw-r--r-- | fs/nfs/nfs3acl.c | 14 | ||||
| -rw-r--r-- | fs/nfsd/vfs.c | 13 | ||||
| -rw-r--r-- | fs/reiserfs/ioctl.c | 6 | ||||
| -rw-r--r-- | fs/reiserfs/journal.c | 12 | ||||
| -rw-r--r-- | fs/reiserfs/super.c | 5 | ||||
| -rw-r--r-- | fs/udf/namei.c | 6 |
24 files changed, 325 insertions, 173 deletions
diff --git a/fs/Makefile b/fs/Makefile index fc92e59e9faf..20edcf28bfd2 100644 --- a/fs/Makefile +++ b/fs/Makefile | |||
| @@ -10,6 +10,7 @@ obj-y := open.o read_write.o file_table.o buffer.o bio.o super.o \ | |||
| 10 | ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \ | 10 | ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \ |
| 11 | attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \ | 11 | attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \ |
| 12 | seq_file.o xattr.o libfs.o fs-writeback.o mpage.o direct-io.o \ | 12 | seq_file.o xattr.o libfs.o fs-writeback.o mpage.o direct-io.o \ |
| 13 | ioprio.o | ||
| 13 | 14 | ||
| 14 | obj-$(CONFIG_EPOLL) += eventpoll.o | 15 | obj-$(CONFIG_EPOLL) += eventpoll.o |
| 15 | obj-$(CONFIG_COMPAT) += compat.o | 16 | obj-$(CONFIG_COMPAT) += compat.o |
| @@ -58,6 +58,7 @@ static DEFINE_SPINLOCK(fput_lock); | |||
| 58 | static LIST_HEAD(fput_head); | 58 | static LIST_HEAD(fput_head); |
| 59 | 59 | ||
| 60 | static void aio_kick_handler(void *); | 60 | static void aio_kick_handler(void *); |
| 61 | static void aio_queue_work(struct kioctx *); | ||
| 61 | 62 | ||
| 62 | /* aio_setup | 63 | /* aio_setup |
| 63 | * Creates the slab caches used by the aio routines, panic on | 64 | * Creates the slab caches used by the aio routines, panic on |
| @@ -747,6 +748,14 @@ out: | |||
| 747 | * has already been kicked */ | 748 | * has already been kicked */ |
| 748 | if (kiocbIsKicked(iocb)) { | 749 | if (kiocbIsKicked(iocb)) { |
| 749 | __queue_kicked_iocb(iocb); | 750 | __queue_kicked_iocb(iocb); |
| 751 | |||
| 752 | /* | ||
| 753 | * __queue_kicked_iocb will always return 1 here, because | ||
| 754 | * iocb->ki_run_list is empty at this point so it should | ||
| 755 | * be safe to unconditionally queue the context into the | ||
| 756 | * work queue. | ||
| 757 | */ | ||
| 758 | aio_queue_work(ctx); | ||
| 750 | } | 759 | } |
| 751 | } | 760 | } |
| 752 | return ret; | 761 | return ret; |
diff --git a/fs/buffer.c b/fs/buffer.c index 13e5938a64f6..561e63a14966 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
| @@ -278,7 +278,7 @@ EXPORT_SYMBOL(thaw_bdev); | |||
| 278 | */ | 278 | */ |
| 279 | static void do_sync(unsigned long wait) | 279 | static void do_sync(unsigned long wait) |
| 280 | { | 280 | { |
| 281 | wakeup_bdflush(0); | 281 | wakeup_pdflush(0); |
| 282 | sync_inodes(0); /* All mappings, inodes and their blockdevs */ | 282 | sync_inodes(0); /* All mappings, inodes and their blockdevs */ |
| 283 | DQUOT_SYNC(NULL); | 283 | DQUOT_SYNC(NULL); |
| 284 | sync_supers(); /* Write the superblocks */ | 284 | sync_supers(); /* Write the superblocks */ |
| @@ -497,7 +497,7 @@ static void free_more_memory(void) | |||
| 497 | struct zone **zones; | 497 | struct zone **zones; |
| 498 | pg_data_t *pgdat; | 498 | pg_data_t *pgdat; |
| 499 | 499 | ||
| 500 | wakeup_bdflush(1024); | 500 | wakeup_pdflush(1024); |
| 501 | yield(); | 501 | yield(); |
| 502 | 502 | ||
| 503 | for_each_pgdat(pgdat) { | 503 | for_each_pgdat(pgdat) { |
diff --git a/fs/char_dev.c b/fs/char_dev.c index e82aac9cc2f5..a69a5d8a406f 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
| @@ -150,7 +150,7 @@ __unregister_chrdev_region(unsigned major, unsigned baseminor, int minorct) | |||
| 150 | struct char_device_struct *cd = NULL, **cp; | 150 | struct char_device_struct *cd = NULL, **cp; |
| 151 | int i = major_to_index(major); | 151 | int i = major_to_index(major); |
| 152 | 152 | ||
| 153 | up(&chrdevs_lock); | 153 | down(&chrdevs_lock); |
| 154 | for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next) | 154 | for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next) |
| 155 | if ((*cp)->major == major && | 155 | if ((*cp)->major == major && |
| 156 | (*cp)->baseminor == baseminor && | 156 | (*cp)->baseminor == baseminor && |
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index ccd632fcc6d8..e463dca008e4 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
| @@ -749,24 +749,24 @@ fail_access: | |||
| 749 | * to find a free region that is of my size and has not | 749 | * to find a free region that is of my size and has not |
| 750 | * been reserved. | 750 | * been reserved. |
| 751 | * | 751 | * |
| 752 | * on succeed, it returns the reservation window to be appended to. | ||
| 753 | * failed, return NULL. | ||
| 754 | */ | 752 | */ |
| 755 | static struct ext3_reserve_window_node *find_next_reservable_window( | 753 | static int find_next_reservable_window( |
| 756 | struct ext3_reserve_window_node *search_head, | 754 | struct ext3_reserve_window_node *search_head, |
| 757 | unsigned long size, int *start_block, | 755 | struct ext3_reserve_window_node *my_rsv, |
| 756 | struct super_block * sb, int start_block, | ||
| 758 | int last_block) | 757 | int last_block) |
| 759 | { | 758 | { |
| 760 | struct rb_node *next; | 759 | struct rb_node *next; |
| 761 | struct ext3_reserve_window_node *rsv, *prev; | 760 | struct ext3_reserve_window_node *rsv, *prev; |
| 762 | int cur; | 761 | int cur; |
| 762 | int size = my_rsv->rsv_goal_size; | ||
| 763 | 763 | ||
| 764 | /* TODO: make the start of the reservation window byte-aligned */ | 764 | /* TODO: make the start of the reservation window byte-aligned */ |
| 765 | /* cur = *start_block & ~7;*/ | 765 | /* cur = *start_block & ~7;*/ |
| 766 | cur = *start_block; | 766 | cur = start_block; |
| 767 | rsv = search_head; | 767 | rsv = search_head; |
| 768 | if (!rsv) | 768 | if (!rsv) |
| 769 | return NULL; | 769 | return -1; |
| 770 | 770 | ||
| 771 | while (1) { | 771 | while (1) { |
| 772 | if (cur <= rsv->rsv_end) | 772 | if (cur <= rsv->rsv_end) |
| @@ -782,11 +782,11 @@ static struct ext3_reserve_window_node *find_next_reservable_window( | |||
| 782 | * space with expected-size (or more)... | 782 | * space with expected-size (or more)... |
| 783 | */ | 783 | */ |
| 784 | if (cur > last_block) | 784 | if (cur > last_block) |
| 785 | return NULL; /* fail */ | 785 | return -1; /* fail */ |
| 786 | 786 | ||
| 787 | prev = rsv; | 787 | prev = rsv; |
| 788 | next = rb_next(&rsv->rsv_node); | 788 | next = rb_next(&rsv->rsv_node); |
| 789 | rsv = list_entry(next, struct ext3_reserve_window_node, rsv_node); | 789 | rsv = list_entry(next,struct ext3_reserve_window_node,rsv_node); |
| 790 | 790 | ||
| 791 | /* | 791 | /* |
| 792 | * Reached the last reservation, we can just append to the | 792 | * Reached the last reservation, we can just append to the |
| @@ -813,8 +813,25 @@ static struct ext3_reserve_window_node *find_next_reservable_window( | |||
| 813 | * return the reservation window that we could append to. | 813 | * return the reservation window that we could append to. |
| 814 | * succeed. | 814 | * succeed. |
| 815 | */ | 815 | */ |
| 816 | *start_block = cur; | 816 | |
| 817 | return prev; | 817 | if ((prev != my_rsv) && (!rsv_is_empty(&my_rsv->rsv_window))) |
| 818 | rsv_window_remove(sb, my_rsv); | ||
| 819 | |||
| 820 | /* | ||
| 821 | * Let's book the whole avaliable window for now. We will check the | ||
| 822 | * disk bitmap later and then, if there are free blocks then we adjust | ||
| 823 | * the window size if it's larger than requested. | ||
| 824 | * Otherwise, we will remove this node from the tree next time | ||
| 825 | * call find_next_reservable_window. | ||
| 826 | */ | ||
| 827 | my_rsv->rsv_start = cur; | ||
| 828 | my_rsv->rsv_end = cur + size - 1; | ||
| 829 | my_rsv->rsv_alloc_hit = 0; | ||
| 830 | |||
| 831 | if (prev != my_rsv) | ||
| 832 | ext3_rsv_window_add(sb, my_rsv); | ||
| 833 | |||
| 834 | return 0; | ||
| 818 | } | 835 | } |
| 819 | 836 | ||
| 820 | /** | 837 | /** |
| @@ -852,6 +869,7 @@ static struct ext3_reserve_window_node *find_next_reservable_window( | |||
| 852 | * @sb: the super block | 869 | * @sb: the super block |
| 853 | * @group: the group we are trying to allocate in | 870 | * @group: the group we are trying to allocate in |
| 854 | * @bitmap_bh: the block group block bitmap | 871 | * @bitmap_bh: the block group block bitmap |
| 872 | * | ||
| 855 | */ | 873 | */ |
| 856 | static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, | 874 | static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, |
| 857 | int goal, struct super_block *sb, | 875 | int goal, struct super_block *sb, |
| @@ -860,10 +878,10 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, | |||
| 860 | struct ext3_reserve_window_node *search_head; | 878 | struct ext3_reserve_window_node *search_head; |
| 861 | int group_first_block, group_end_block, start_block; | 879 | int group_first_block, group_end_block, start_block; |
| 862 | int first_free_block; | 880 | int first_free_block; |
| 863 | int reservable_space_start; | ||
| 864 | struct ext3_reserve_window_node *prev_rsv; | ||
| 865 | struct rb_root *fs_rsv_root = &EXT3_SB(sb)->s_rsv_window_root; | 881 | struct rb_root *fs_rsv_root = &EXT3_SB(sb)->s_rsv_window_root; |
| 866 | unsigned long size; | 882 | unsigned long size; |
| 883 | int ret; | ||
| 884 | spinlock_t *rsv_lock = &EXT3_SB(sb)->s_rsv_window_lock; | ||
| 867 | 885 | ||
| 868 | group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) + | 886 | group_first_block = le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block) + |
| 869 | group * EXT3_BLOCKS_PER_GROUP(sb); | 887 | group * EXT3_BLOCKS_PER_GROUP(sb); |
| @@ -875,6 +893,7 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, | |||
| 875 | start_block = goal + group_first_block; | 893 | start_block = goal + group_first_block; |
| 876 | 894 | ||
| 877 | size = my_rsv->rsv_goal_size; | 895 | size = my_rsv->rsv_goal_size; |
| 896 | |||
| 878 | if (!rsv_is_empty(&my_rsv->rsv_window)) { | 897 | if (!rsv_is_empty(&my_rsv->rsv_window)) { |
| 879 | /* | 898 | /* |
| 880 | * if the old reservation is cross group boundary | 899 | * if the old reservation is cross group boundary |
| @@ -908,6 +927,8 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, | |||
| 908 | my_rsv->rsv_goal_size= size; | 927 | my_rsv->rsv_goal_size= size; |
| 909 | } | 928 | } |
| 910 | } | 929 | } |
| 930 | |||
| 931 | spin_lock(rsv_lock); | ||
| 911 | /* | 932 | /* |
| 912 | * shift the search start to the window near the goal block | 933 | * shift the search start to the window near the goal block |
| 913 | */ | 934 | */ |
| @@ -921,11 +942,16 @@ static int alloc_new_reservation(struct ext3_reserve_window_node *my_rsv, | |||
| 921 | * need to check the bitmap after we found a reservable window. | 942 | * need to check the bitmap after we found a reservable window. |
| 922 | */ | 943 | */ |
| 923 | retry: | 944 | retry: |
| 924 | prev_rsv = find_next_reservable_window(search_head, size, | 945 | ret = find_next_reservable_window(search_head, my_rsv, sb, |
| 925 | &start_block, group_end_block); | 946 | start_block, group_end_block); |
| 926 | if (prev_rsv == NULL) | 947 | |
| 927 | goto failed; | 948 | if (ret == -1) { |
| 928 | reservable_space_start = start_block; | 949 | if (!rsv_is_empty(&my_rsv->rsv_window)) |
| 950 | rsv_window_remove(sb, my_rsv); | ||
| 951 | spin_unlock(rsv_lock); | ||
| 952 | return -1; | ||
| 953 | } | ||
| 954 | |||
| 929 | /* | 955 | /* |
| 930 | * On success, find_next_reservable_window() returns the | 956 | * On success, find_next_reservable_window() returns the |
| 931 | * reservation window where there is a reservable space after it. | 957 | * reservation window where there is a reservable space after it. |
| @@ -937,8 +963,9 @@ retry: | |||
| 937 | * block. Search start from the start block of the reservable space | 963 | * block. Search start from the start block of the reservable space |
| 938 | * we just found. | 964 | * we just found. |
| 939 | */ | 965 | */ |
| 966 | spin_unlock(rsv_lock); | ||
| 940 | first_free_block = bitmap_search_next_usable_block( | 967 | first_free_block = bitmap_search_next_usable_block( |
| 941 | reservable_space_start - group_first_block, | 968 | my_rsv->rsv_start - group_first_block, |
| 942 | bitmap_bh, group_end_block - group_first_block + 1); | 969 | bitmap_bh, group_end_block - group_first_block + 1); |
| 943 | 970 | ||
| 944 | if (first_free_block < 0) { | 971 | if (first_free_block < 0) { |
| @@ -946,54 +973,29 @@ retry: | |||
| 946 | * no free block left on the bitmap, no point | 973 | * no free block left on the bitmap, no point |
| 947 | * to reserve the space. return failed. | 974 | * to reserve the space. return failed. |
| 948 | */ | 975 | */ |
| 949 | goto failed; | 976 | spin_lock(rsv_lock); |
| 977 | if (!rsv_is_empty(&my_rsv->rsv_window)) | ||
| 978 | rsv_window_remove(sb, my_rsv); | ||
| 979 | spin_unlock(rsv_lock); | ||
| 980 | return -1; /* failed */ | ||
| 950 | } | 981 | } |
| 982 | |||
| 951 | start_block = first_free_block + group_first_block; | 983 | start_block = first_free_block + group_first_block; |
| 952 | /* | 984 | /* |
| 953 | * check if the first free block is within the | 985 | * check if the first free block is within the |
| 954 | * free space we just found | 986 | * free space we just reserved |
| 955 | */ | 987 | */ |
| 956 | if ((start_block >= reservable_space_start) && | 988 | if (start_block >= my_rsv->rsv_start && start_block < my_rsv->rsv_end) |
| 957 | (start_block < reservable_space_start + size)) | 989 | return 0; /* success */ |
| 958 | goto found_rsv_window; | ||
| 959 | /* | 990 | /* |
| 960 | * if the first free bit we found is out of the reservable space | 991 | * if the first free bit we found is out of the reservable space |
| 961 | * this means there is no free block on the reservable space | 992 | * continue search for next reservable space, |
| 962 | * we should continue search for next reservable space, | ||
| 963 | * start from where the free block is, | 993 | * start from where the free block is, |
| 964 | * we also shift the list head to where we stopped last time | 994 | * we also shift the list head to where we stopped last time |
| 965 | */ | 995 | */ |
| 966 | search_head = prev_rsv; | 996 | search_head = my_rsv; |
| 997 | spin_lock(rsv_lock); | ||
| 967 | goto retry; | 998 | goto retry; |
| 968 | |||
| 969 | found_rsv_window: | ||
| 970 | /* | ||
| 971 | * great! the reservable space contains some free blocks. | ||
| 972 | * if the search returns that we should add the new | ||
| 973 | * window just next to where the old window, we don't | ||
| 974 | * need to remove the old window first then add it to the | ||
| 975 | * same place, just update the new start and new end. | ||
| 976 | */ | ||
| 977 | if (my_rsv != prev_rsv) { | ||
| 978 | if (!rsv_is_empty(&my_rsv->rsv_window)) | ||
| 979 | rsv_window_remove(sb, my_rsv); | ||
| 980 | } | ||
| 981 | my_rsv->rsv_start = reservable_space_start; | ||
| 982 | my_rsv->rsv_end = my_rsv->rsv_start + size - 1; | ||
| 983 | my_rsv->rsv_alloc_hit = 0; | ||
| 984 | if (my_rsv != prev_rsv) { | ||
| 985 | ext3_rsv_window_add(sb, my_rsv); | ||
| 986 | } | ||
| 987 | return 0; /* succeed */ | ||
| 988 | failed: | ||
| 989 | /* | ||
| 990 | * failed to find a new reservation window in the current | ||
| 991 | * group, remove the current(stale) reservation window | ||
| 992 | * if there is any | ||
| 993 | */ | ||
| 994 | if (!rsv_is_empty(&my_rsv->rsv_window)) | ||
| 995 | rsv_window_remove(sb, my_rsv); | ||
| 996 | return -1; /* failed */ | ||
| 997 | } | 999 | } |
| 998 | 1000 | ||
| 999 | /* | 1001 | /* |
| @@ -1023,7 +1025,6 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, | |||
| 1023 | int goal, struct ext3_reserve_window_node * my_rsv, | 1025 | int goal, struct ext3_reserve_window_node * my_rsv, |
| 1024 | int *errp) | 1026 | int *errp) |
| 1025 | { | 1027 | { |
| 1026 | spinlock_t *rsv_lock; | ||
| 1027 | unsigned long group_first_block; | 1028 | unsigned long group_first_block; |
| 1028 | int ret = 0; | 1029 | int ret = 0; |
| 1029 | int fatal; | 1030 | int fatal; |
| @@ -1052,7 +1053,6 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, | |||
| 1052 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, goal, NULL); | 1053 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, goal, NULL); |
| 1053 | goto out; | 1054 | goto out; |
| 1054 | } | 1055 | } |
| 1055 | rsv_lock = &EXT3_SB(sb)->s_rsv_window_lock; | ||
| 1056 | /* | 1056 | /* |
| 1057 | * goal is a group relative block number (if there is a goal) | 1057 | * goal is a group relative block number (if there is a goal) |
| 1058 | * 0 < goal < EXT3_BLOCKS_PER_GROUP(sb) | 1058 | * 0 < goal < EXT3_BLOCKS_PER_GROUP(sb) |
| @@ -1078,30 +1078,21 @@ ext3_try_to_allocate_with_rsv(struct super_block *sb, handle_t *handle, | |||
| 1078 | * then we could go to allocate from the reservation window directly. | 1078 | * then we could go to allocate from the reservation window directly. |
| 1079 | */ | 1079 | */ |
| 1080 | while (1) { | 1080 | while (1) { |
| 1081 | struct ext3_reserve_window rsv_copy; | 1081 | if (rsv_is_empty(&my_rsv->rsv_window) || (ret < 0) || |
| 1082 | 1082 | !goal_in_my_reservation(&my_rsv->rsv_window, goal, group, sb)) { | |
| 1083 | rsv_copy._rsv_start = my_rsv->rsv_start; | ||
| 1084 | rsv_copy._rsv_end = my_rsv->rsv_end; | ||
| 1085 | |||
| 1086 | if (rsv_is_empty(&rsv_copy) || (ret < 0) || | ||
| 1087 | !goal_in_my_reservation(&rsv_copy, goal, group, sb)) { | ||
| 1088 | spin_lock(rsv_lock); | ||
| 1089 | ret = alloc_new_reservation(my_rsv, goal, sb, | 1083 | ret = alloc_new_reservation(my_rsv, goal, sb, |
| 1090 | group, bitmap_bh); | 1084 | group, bitmap_bh); |
| 1091 | rsv_copy._rsv_start = my_rsv->rsv_start; | ||
| 1092 | rsv_copy._rsv_end = my_rsv->rsv_end; | ||
| 1093 | spin_unlock(rsv_lock); | ||
| 1094 | if (ret < 0) | 1085 | if (ret < 0) |
| 1095 | break; /* failed */ | 1086 | break; /* failed */ |
| 1096 | 1087 | ||
| 1097 | if (!goal_in_my_reservation(&rsv_copy, goal, group, sb)) | 1088 | if (!goal_in_my_reservation(&my_rsv->rsv_window, goal, group, sb)) |
| 1098 | goal = -1; | 1089 | goal = -1; |
| 1099 | } | 1090 | } |
| 1100 | if ((rsv_copy._rsv_start >= group_first_block + EXT3_BLOCKS_PER_GROUP(sb)) | 1091 | if ((my_rsv->rsv_start >= group_first_block + EXT3_BLOCKS_PER_GROUP(sb)) |
| 1101 | || (rsv_copy._rsv_end < group_first_block)) | 1092 | || (my_rsv->rsv_end < group_first_block)) |
| 1102 | BUG(); | 1093 | BUG(); |
| 1103 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, goal, | 1094 | ret = ext3_try_to_allocate(sb, handle, group, bitmap_bh, goal, |
| 1104 | &rsv_copy); | 1095 | &my_rsv->rsv_window); |
| 1105 | if (ret >= 0) { | 1096 | if (ret >= 0) { |
| 1106 | my_rsv->rsv_alloc_hit++; | 1097 | my_rsv->rsv_alloc_hit++; |
| 1107 | break; /* succeed */ | 1098 | break; /* succeed */ |
diff --git a/fs/ext3/file.c b/fs/ext3/file.c index 5ad8cf0292df..98e78345ead9 100644 --- a/fs/ext3/file.c +++ b/fs/ext3/file.c | |||
| @@ -36,7 +36,11 @@ static int ext3_release_file (struct inode * inode, struct file * filp) | |||
| 36 | /* if we are the last writer on the inode, drop the block reservation */ | 36 | /* if we are the last writer on the inode, drop the block reservation */ |
| 37 | if ((filp->f_mode & FMODE_WRITE) && | 37 | if ((filp->f_mode & FMODE_WRITE) && |
| 38 | (atomic_read(&inode->i_writecount) == 1)) | 38 | (atomic_read(&inode->i_writecount) == 1)) |
| 39 | { | ||
| 40 | down(&EXT3_I(inode)->truncate_sem); | ||
| 39 | ext3_discard_reservation(inode); | 41 | ext3_discard_reservation(inode); |
| 42 | up(&EXT3_I(inode)->truncate_sem); | ||
| 43 | } | ||
| 40 | if (is_dx(inode) && filp->private_data) | 44 | if (is_dx(inode) && filp->private_data) |
| 41 | ext3_htree_free_dir_info(filp->private_data); | 45 | ext3_htree_free_dir_info(filp->private_data); |
| 42 | 46 | ||
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index b4b3e8a39131..a6d1779d7de4 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
| @@ -944,7 +944,8 @@ clear_qf_name: | |||
| 944 | "for remount\n"); | 944 | "for remount\n"); |
| 945 | return 0; | 945 | return 0; |
| 946 | } | 946 | } |
| 947 | match_int(&args[0], &option); | 947 | if (match_int(&args[0], &option) != 0) |
| 948 | return 0; | ||
| 948 | *n_blocks_count = option; | 949 | *n_blocks_count = option; |
| 949 | break; | 950 | break; |
| 950 | case Opt_nobh: | 951 | case Opt_nobh: |
diff --git a/fs/fat/cache.c b/fs/fat/cache.c index 7c52e465a619..77c24fcf712a 100644 --- a/fs/fat/cache.c +++ b/fs/fat/cache.c | |||
| @@ -56,7 +56,7 @@ int __init fat_cache_init(void) | |||
| 56 | return 0; | 56 | return 0; |
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | void __exit fat_cache_destroy(void) | 59 | void fat_cache_destroy(void) |
| 60 | { | 60 | { |
| 61 | if (kmem_cache_destroy(fat_cache_cachep)) | 61 | if (kmem_cache_destroy(fat_cache_cachep)) |
| 62 | printk(KERN_INFO "fat_cache: not all structures were freed\n"); | 62 | printk(KERN_INFO "fat_cache: not all structures were freed\n"); |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 8ccee8415488..96ae85b67eba 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
| @@ -1327,16 +1327,25 @@ out_fail: | |||
| 1327 | EXPORT_SYMBOL(fat_fill_super); | 1327 | EXPORT_SYMBOL(fat_fill_super); |
| 1328 | 1328 | ||
| 1329 | int __init fat_cache_init(void); | 1329 | int __init fat_cache_init(void); |
| 1330 | void __exit fat_cache_destroy(void); | 1330 | void fat_cache_destroy(void); |
| 1331 | 1331 | ||
| 1332 | static int __init init_fat_fs(void) | 1332 | static int __init init_fat_fs(void) |
| 1333 | { | 1333 | { |
| 1334 | int ret; | 1334 | int err; |
| 1335 | 1335 | ||
| 1336 | ret = fat_cache_init(); | 1336 | err = fat_cache_init(); |
| 1337 | if (ret < 0) | 1337 | if (err) |
| 1338 | return ret; | 1338 | return err; |
| 1339 | return fat_init_inodecache(); | 1339 | |
| 1340 | err = fat_init_inodecache(); | ||
| 1341 | if (err) | ||
| 1342 | goto failed; | ||
| 1343 | |||
| 1344 | return 0; | ||
| 1345 | |||
| 1346 | failed: | ||
| 1347 | fat_cache_destroy(); | ||
| 1348 | return err; | ||
| 1340 | } | 1349 | } |
| 1341 | 1350 | ||
| 1342 | static void __exit exit_fat_fs(void) | 1351 | static void __exit exit_fat_fs(void) |
diff --git a/fs/freevxfs/vxfs.h b/fs/freevxfs/vxfs.h index 8da0252642a4..583bd78086d8 100644 --- a/fs/freevxfs/vxfs.h +++ b/fs/freevxfs/vxfs.h | |||
| @@ -37,7 +37,6 @@ | |||
| 37 | * superblocks of the Veritas Filesystem. | 37 | * superblocks of the Veritas Filesystem. |
| 38 | */ | 38 | */ |
| 39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
| 40 | #include "vxfs_kcompat.h" | ||
| 41 | 40 | ||
| 42 | 41 | ||
| 43 | /* | 42 | /* |
diff --git a/fs/freevxfs/vxfs_bmap.c b/fs/freevxfs/vxfs_bmap.c index bc4b57da306a..d3f6b2835bc8 100644 --- a/fs/freevxfs/vxfs_bmap.c +++ b/fs/freevxfs/vxfs_bmap.c | |||
| @@ -101,7 +101,7 @@ vxfs_bmap_ext4(struct inode *ip, long bn) | |||
| 101 | return 0; | 101 | return 0; |
| 102 | 102 | ||
| 103 | fail_size: | 103 | fail_size: |
| 104 | printk("vxfs: indirect extent to big!\n"); | 104 | printk("vxfs: indirect extent too big!\n"); |
| 105 | fail_buf: | 105 | fail_buf: |
| 106 | return 0; | 106 | return 0; |
| 107 | } | 107 | } |
diff --git a/fs/freevxfs/vxfs_fshead.c b/fs/freevxfs/vxfs_fshead.c index 05b19f70bf97..6dee109aeea4 100644 --- a/fs/freevxfs/vxfs_fshead.c +++ b/fs/freevxfs/vxfs_fshead.c | |||
| @@ -78,17 +78,18 @@ vxfs_getfsh(struct inode *ip, int which) | |||
| 78 | struct buffer_head *bp; | 78 | struct buffer_head *bp; |
| 79 | 79 | ||
| 80 | bp = vxfs_bread(ip, which); | 80 | bp = vxfs_bread(ip, which); |
| 81 | if (buffer_mapped(bp)) { | 81 | if (bp) { |
| 82 | struct vxfs_fsh *fhp; | 82 | struct vxfs_fsh *fhp; |
| 83 | 83 | ||
| 84 | if (!(fhp = kmalloc(sizeof(*fhp), SLAB_KERNEL))) | 84 | if (!(fhp = kmalloc(sizeof(*fhp), GFP_KERNEL))) |
| 85 | return NULL; | 85 | goto out; |
| 86 | memcpy(fhp, bp->b_data, sizeof(*fhp)); | 86 | memcpy(fhp, bp->b_data, sizeof(*fhp)); |
| 87 | 87 | ||
| 88 | brelse(bp); | 88 | put_bh(bp); |
| 89 | return (fhp); | 89 | return (fhp); |
| 90 | } | 90 | } |
| 91 | 91 | out: | |
| 92 | brelse(bp); | ||
| 92 | return NULL; | 93 | return NULL; |
| 93 | } | 94 | } |
| 94 | 95 | ||
diff --git a/fs/freevxfs/vxfs_kcompat.h b/fs/freevxfs/vxfs_kcompat.h deleted file mode 100644 index 342a4cc860f4..000000000000 --- a/fs/freevxfs/vxfs_kcompat.h +++ /dev/null | |||
| @@ -1,49 +0,0 @@ | |||
| 1 | #ifndef _VXFS_KCOMPAT_H | ||
| 2 | #define _VXFS_KCOMPAT_H | ||
| 3 | |||
| 4 | #include <linux/version.h> | ||
| 5 | |||
| 6 | #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) | ||
| 7 | |||
| 8 | #include <linux/blkdev.h> | ||
| 9 | |||
| 10 | typedef long sector_t; | ||
| 11 | |||
| 12 | /* From include/linux/fs.h (Linux 2.5.2-pre3) */ | ||
| 13 | static inline struct buffer_head * sb_bread(struct super_block *sb, int block) | ||
| 14 | { | ||
| 15 | return bread(sb->s_dev, block, sb->s_blocksize); | ||
| 16 | } | ||
| 17 | |||
| 18 | /* Dito. */ | ||
| 19 | static inline void map_bh(struct buffer_head *bh, struct super_block *sb, int block) | ||
| 20 | { | ||
| 21 | bh->b_state |= 1 << BH_Mapped; | ||
| 22 | bh->b_dev = sb->s_dev; | ||
| 23 | bh->b_blocknr = block; | ||
| 24 | } | ||
| 25 | |||
| 26 | /* From fs/block_dev.c (Linux 2.5.2-pre2) */ | ||
| 27 | static inline int sb_set_blocksize(struct super_block *sb, int size) | ||
| 28 | { | ||
| 29 | int bits; | ||
| 30 | if (set_blocksize(sb->s_dev, size) < 0) | ||
| 31 | return 0; | ||
| 32 | sb->s_blocksize = size; | ||
| 33 | for (bits = 9, size >>= 9; size >>= 1; bits++) | ||
| 34 | ; | ||
| 35 | sb->s_blocksize_bits = bits; | ||
| 36 | return sb->s_blocksize; | ||
| 37 | } | ||
| 38 | |||
| 39 | /* Dito. */ | ||
| 40 | static inline int sb_min_blocksize(struct super_block *sb, int size) | ||
| 41 | { | ||
| 42 | int minsize = get_hardsect_size(sb->s_dev); | ||
| 43 | if (size < minsize) | ||
| 44 | size = minsize; | ||
| 45 | return sb_set_blocksize(sb, size); | ||
| 46 | } | ||
| 47 | |||
| 48 | #endif /* Kernel 2.4 */ | ||
| 49 | #endif /* _VXFS_KCOMPAT_H */ | ||
diff --git a/fs/freevxfs/vxfs_lookup.c b/fs/freevxfs/vxfs_lookup.c index 506ae251d2c0..554eb455722c 100644 --- a/fs/freevxfs/vxfs_lookup.c +++ b/fs/freevxfs/vxfs_lookup.c | |||
| @@ -61,13 +61,13 @@ struct file_operations vxfs_dir_operations = { | |||
| 61 | }; | 61 | }; |
| 62 | 62 | ||
| 63 | 63 | ||
| 64 | static __inline__ u_long | 64 | static inline u_long |
| 65 | dir_pages(struct inode *inode) | 65 | dir_pages(struct inode *inode) |
| 66 | { | 66 | { |
| 67 | return (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; | 67 | return (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | static __inline__ u_long | 70 | static inline u_long |
| 71 | dir_blocks(struct inode *ip) | 71 | dir_blocks(struct inode *ip) |
| 72 | { | 72 | { |
| 73 | u_long bsize = ip->i_sb->s_blocksize; | 73 | u_long bsize = ip->i_sb->s_blocksize; |
| @@ -79,7 +79,7 @@ dir_blocks(struct inode *ip) | |||
| 79 | * | 79 | * |
| 80 | * len <= VXFS_NAMELEN and de != NULL are guaranteed by caller. | 80 | * len <= VXFS_NAMELEN and de != NULL are guaranteed by caller. |
| 81 | */ | 81 | */ |
| 82 | static __inline__ int | 82 | static inline int |
| 83 | vxfs_match(int len, const char * const name, struct vxfs_direct *de) | 83 | vxfs_match(int len, const char * const name, struct vxfs_direct *de) |
| 84 | { | 84 | { |
| 85 | if (len != de->d_namelen) | 85 | if (len != de->d_namelen) |
| @@ -89,7 +89,7 @@ vxfs_match(int len, const char * const name, struct vxfs_direct *de) | |||
| 89 | return !memcmp(name, de->d_name, len); | 89 | return !memcmp(name, de->d_name, len); |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | static __inline__ struct vxfs_direct * | 92 | static inline struct vxfs_direct * |
| 93 | vxfs_next_entry(struct vxfs_direct *de) | 93 | vxfs_next_entry(struct vxfs_direct *de) |
| 94 | { | 94 | { |
| 95 | return ((struct vxfs_direct *)((char*)de + de->d_reclen)); | 95 | return ((struct vxfs_direct *)((char*)de + de->d_reclen)); |
diff --git a/fs/freevxfs/vxfs_olt.c b/fs/freevxfs/vxfs_olt.c index 7a204e31aad9..133476201d84 100644 --- a/fs/freevxfs/vxfs_olt.c +++ b/fs/freevxfs/vxfs_olt.c | |||
| @@ -38,7 +38,7 @@ | |||
| 38 | #include "vxfs_olt.h" | 38 | #include "vxfs_olt.h" |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | static __inline__ void | 41 | static inline void |
| 42 | vxfs_get_fshead(struct vxfs_oltfshead *fshp, struct vxfs_sb_info *infp) | 42 | vxfs_get_fshead(struct vxfs_oltfshead *fshp, struct vxfs_sb_info *infp) |
| 43 | { | 43 | { |
| 44 | if (infp->vsi_fshino) | 44 | if (infp->vsi_fshino) |
| @@ -46,7 +46,7 @@ vxfs_get_fshead(struct vxfs_oltfshead *fshp, struct vxfs_sb_info *infp) | |||
| 46 | infp->vsi_fshino = fshp->olt_fsino[0]; | 46 | infp->vsi_fshino = fshp->olt_fsino[0]; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | static __inline__ void | 49 | static inline void |
| 50 | vxfs_get_ilist(struct vxfs_oltilist *ilistp, struct vxfs_sb_info *infp) | 50 | vxfs_get_ilist(struct vxfs_oltilist *ilistp, struct vxfs_sb_info *infp) |
| 51 | { | 51 | { |
| 52 | if (infp->vsi_iext) | 52 | if (infp->vsi_iext) |
| @@ -54,7 +54,7 @@ vxfs_get_ilist(struct vxfs_oltilist *ilistp, struct vxfs_sb_info *infp) | |||
| 54 | infp->vsi_iext = ilistp->olt_iext[0]; | 54 | infp->vsi_iext = ilistp->olt_iext[0]; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static __inline__ u_long | 57 | static inline u_long |
| 58 | vxfs_oblock(struct super_block *sbp, daddr_t block, u_long bsize) | 58 | vxfs_oblock(struct super_block *sbp, daddr_t block, u_long bsize) |
| 59 | { | 59 | { |
| 60 | if (sbp->s_blocksize % bsize) | 60 | if (sbp->s_blocksize % bsize) |
| @@ -104,8 +104,8 @@ vxfs_read_olt(struct super_block *sbp, u_long bsize) | |||
| 104 | goto fail; | 104 | goto fail; |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | oaddr = (char *)bp->b_data + op->olt_size; | 107 | oaddr = bp->b_data + op->olt_size; |
| 108 | eaddr = (char *)bp->b_data + (infp->vsi_oltsize * sbp->s_blocksize); | 108 | eaddr = bp->b_data + (infp->vsi_oltsize * sbp->s_blocksize); |
| 109 | 109 | ||
| 110 | while (oaddr < eaddr) { | 110 | while (oaddr < eaddr) { |
| 111 | struct vxfs_oltcommon *ocp = | 111 | struct vxfs_oltcommon *ocp = |
diff --git a/fs/freevxfs/vxfs_subr.c b/fs/freevxfs/vxfs_subr.c index 5e305612054a..50aae77651b2 100644 --- a/fs/freevxfs/vxfs_subr.c +++ b/fs/freevxfs/vxfs_subr.c | |||
| @@ -36,7 +36,6 @@ | |||
| 36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
| 37 | #include <linux/pagemap.h> | 37 | #include <linux/pagemap.h> |
| 38 | 38 | ||
| 39 | #include "vxfs_kcompat.h" | ||
| 40 | #include "vxfs_extern.h" | 39 | #include "vxfs_extern.h" |
| 41 | 40 | ||
| 42 | 41 | ||
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index 0ae2c7b8182a..27f66d3e8a04 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c | |||
| @@ -155,12 +155,11 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) | |||
| 155 | 155 | ||
| 156 | sbp->s_flags |= MS_RDONLY; | 156 | sbp->s_flags |= MS_RDONLY; |
| 157 | 157 | ||
| 158 | infp = kmalloc(sizeof(*infp), GFP_KERNEL); | 158 | infp = kcalloc(1, sizeof(*infp), GFP_KERNEL); |
| 159 | if (!infp) { | 159 | if (!infp) { |
| 160 | printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n"); | 160 | printk(KERN_WARNING "vxfs: unable to allocate incore superblock\n"); |
| 161 | return -ENOMEM; | 161 | return -ENOMEM; |
| 162 | } | 162 | } |
| 163 | memset(infp, 0, sizeof(*infp)); | ||
| 164 | 163 | ||
| 165 | bsize = sb_min_blocksize(sbp, BLOCK_SIZE); | 164 | bsize = sb_min_blocksize(sbp, BLOCK_SIZE); |
| 166 | if (!bsize) { | 165 | if (!bsize) { |
| @@ -196,7 +195,7 @@ static int vxfs_fill_super(struct super_block *sbp, void *dp, int silent) | |||
| 196 | #endif | 195 | #endif |
| 197 | 196 | ||
| 198 | sbp->s_magic = rsbp->vs_magic; | 197 | sbp->s_magic = rsbp->vs_magic; |
| 199 | sbp->s_fs_info = (void *)infp; | 198 | sbp->s_fs_info = infp; |
| 200 | 199 | ||
| 201 | infp->vsi_raw = rsbp; | 200 | infp->vsi_raw = rsbp; |
| 202 | infp->vsi_bp = bp; | 201 | infp->vsi_bp = bp; |
| @@ -263,7 +262,7 @@ vxfs_init(void) | |||
| 263 | sizeof(struct vxfs_inode_info), 0, | 262 | sizeof(struct vxfs_inode_info), 0, |
| 264 | SLAB_RECLAIM_ACCOUNT, NULL, NULL); | 263 | SLAB_RECLAIM_ACCOUNT, NULL, NULL); |
| 265 | if (vxfs_inode_cachep) | 264 | if (vxfs_inode_cachep) |
| 266 | return (register_filesystem(&vxfs_fs_type)); | 265 | return register_filesystem(&vxfs_fs_type); |
| 267 | return -ENOMEM; | 266 | return -ENOMEM; |
| 268 | } | 267 | } |
| 269 | 268 | ||
diff --git a/fs/ioprio.c b/fs/ioprio.c new file mode 100644 index 000000000000..663e420636d6 --- /dev/null +++ b/fs/ioprio.c | |||
| @@ -0,0 +1,172 @@ | |||
| 1 | /* | ||
| 2 | * fs/ioprio.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2004 Jens Axboe <axboe@suse.de> | ||
| 5 | * | ||
| 6 | * Helper functions for setting/querying io priorities of processes. The | ||
| 7 | * system calls closely mimmick getpriority/setpriority, see the man page for | ||
| 8 | * those. The prio argument is a composite of prio class and prio data, where | ||
| 9 | * the data argument has meaning within that class. The standard scheduling | ||
| 10 | * classes have 8 distinct prio levels, with 0 being the highest prio and 7 | ||
| 11 | * being the lowest. | ||
| 12 | * | ||
| 13 | * IOW, setting BE scheduling class with prio 2 is done ala: | ||
| 14 | * | ||
| 15 | * unsigned int prio = (IOPRIO_CLASS_BE << IOPRIO_CLASS_SHIFT) | 2; | ||
| 16 | * | ||
| 17 | * ioprio_set(PRIO_PROCESS, pid, prio); | ||
| 18 | * | ||
| 19 | * See also Documentation/block/ioprio.txt | ||
| 20 | * | ||
| 21 | */ | ||
| 22 | #include <linux/kernel.h> | ||
| 23 | #include <linux/ioprio.h> | ||
| 24 | #include <linux/blkdev.h> | ||
| 25 | |||
| 26 | static int set_task_ioprio(struct task_struct *task, int ioprio) | ||
| 27 | { | ||
| 28 | struct io_context *ioc; | ||
| 29 | |||
| 30 | if (task->uid != current->euid && | ||
| 31 | task->uid != current->uid && !capable(CAP_SYS_NICE)) | ||
| 32 | return -EPERM; | ||
| 33 | |||
| 34 | task_lock(task); | ||
| 35 | |||
| 36 | task->ioprio = ioprio; | ||
| 37 | |||
| 38 | ioc = task->io_context; | ||
| 39 | if (ioc && ioc->set_ioprio) | ||
| 40 | ioc->set_ioprio(ioc, ioprio); | ||
| 41 | |||
| 42 | task_unlock(task); | ||
| 43 | return 0; | ||
| 44 | } | ||
| 45 | |||
| 46 | asmlinkage int sys_ioprio_set(int which, int who, int ioprio) | ||
| 47 | { | ||
| 48 | int class = IOPRIO_PRIO_CLASS(ioprio); | ||
| 49 | int data = IOPRIO_PRIO_DATA(ioprio); | ||
| 50 | struct task_struct *p, *g; | ||
| 51 | struct user_struct *user; | ||
| 52 | int ret; | ||
| 53 | |||
| 54 | switch (class) { | ||
| 55 | case IOPRIO_CLASS_RT: | ||
| 56 | if (!capable(CAP_SYS_ADMIN)) | ||
| 57 | return -EPERM; | ||
| 58 | /* fall through, rt has prio field too */ | ||
| 59 | case IOPRIO_CLASS_BE: | ||
| 60 | if (data >= IOPRIO_BE_NR || data < 0) | ||
| 61 | return -EINVAL; | ||
| 62 | |||
| 63 | break; | ||
| 64 | case IOPRIO_CLASS_IDLE: | ||
| 65 | break; | ||
| 66 | default: | ||
| 67 | return -EINVAL; | ||
| 68 | } | ||
| 69 | |||
| 70 | ret = -ESRCH; | ||
| 71 | read_lock_irq(&tasklist_lock); | ||
| 72 | switch (which) { | ||
| 73 | case IOPRIO_WHO_PROCESS: | ||
| 74 | if (!who) | ||
| 75 | p = current; | ||
| 76 | else | ||
| 77 | p = find_task_by_pid(who); | ||
| 78 | if (p) | ||
| 79 | ret = set_task_ioprio(p, ioprio); | ||
| 80 | break; | ||
| 81 | case IOPRIO_WHO_PGRP: | ||
| 82 | if (!who) | ||
| 83 | who = process_group(current); | ||
| 84 | do_each_task_pid(who, PIDTYPE_PGID, p) { | ||
| 85 | ret = set_task_ioprio(p, ioprio); | ||
| 86 | if (ret) | ||
| 87 | break; | ||
| 88 | } while_each_task_pid(who, PIDTYPE_PGID, p); | ||
| 89 | break; | ||
| 90 | case IOPRIO_WHO_USER: | ||
| 91 | if (!who) | ||
| 92 | user = current->user; | ||
| 93 | else | ||
| 94 | user = find_user(who); | ||
| 95 | |||
| 96 | if (!user) | ||
| 97 | break; | ||
| 98 | |||
| 99 | do_each_thread(g, p) { | ||
| 100 | if (p->uid != who) | ||
| 101 | continue; | ||
| 102 | ret = set_task_ioprio(p, ioprio); | ||
| 103 | if (ret) | ||
| 104 | break; | ||
| 105 | } while_each_thread(g, p); | ||
| 106 | |||
| 107 | if (who) | ||
| 108 | free_uid(user); | ||
| 109 | break; | ||
| 110 | default: | ||
| 111 | ret = -EINVAL; | ||
| 112 | } | ||
| 113 | |||
| 114 | read_unlock_irq(&tasklist_lock); | ||
| 115 | return ret; | ||
| 116 | } | ||
| 117 | |||
| 118 | asmlinkage int sys_ioprio_get(int which, int who) | ||
| 119 | { | ||
| 120 | struct task_struct *g, *p; | ||
| 121 | struct user_struct *user; | ||
| 122 | int ret = -ESRCH; | ||
| 123 | |||
| 124 | read_lock_irq(&tasklist_lock); | ||
| 125 | switch (which) { | ||
| 126 | case IOPRIO_WHO_PROCESS: | ||
| 127 | if (!who) | ||
| 128 | p = current; | ||
| 129 | else | ||
| 130 | p = find_task_by_pid(who); | ||
| 131 | if (p) | ||
| 132 | ret = p->ioprio; | ||
| 133 | break; | ||
| 134 | case IOPRIO_WHO_PGRP: | ||
| 135 | if (!who) | ||
| 136 | who = process_group(current); | ||
| 137 | do_each_task_pid(who, PIDTYPE_PGID, p) { | ||
| 138 | if (ret == -ESRCH) | ||
| 139 | ret = p->ioprio; | ||
| 140 | else | ||
| 141 | ret = ioprio_best(ret, p->ioprio); | ||
| 142 | } while_each_task_pid(who, PIDTYPE_PGID, p); | ||
| 143 | break; | ||
| 144 | case IOPRIO_WHO_USER: | ||
| 145 | if (!who) | ||
| 146 | user = current->user; | ||
| 147 | else | ||
| 148 | user = find_user(who); | ||
| 149 | |||
| 150 | if (!user) | ||
| 151 | break; | ||
| 152 | |||
| 153 | do_each_thread(g, p) { | ||
| 154 | if (p->uid != user->uid) | ||
| 155 | continue; | ||
| 156 | if (ret == -ESRCH) | ||
| 157 | ret = p->ioprio; | ||
| 158 | else | ||
| 159 | ret = ioprio_best(ret, p->ioprio); | ||
| 160 | } while_each_thread(g, p); | ||
| 161 | |||
| 162 | if (who) | ||
| 163 | free_uid(user); | ||
| 164 | break; | ||
| 165 | default: | ||
| 166 | ret = -EINVAL; | ||
| 167 | } | ||
| 168 | |||
| 169 | read_unlock_irq(&tasklist_lock); | ||
| 170 | return ret; | ||
| 171 | } | ||
| 172 | |||
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c index ee3536fc84a3..1b7a3ef2f813 100644 --- a/fs/nfs/nfs3acl.c +++ b/fs/nfs/nfs3acl.c | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #include <linux/nfs.h> | 2 | #include <linux/nfs.h> |
| 3 | #include <linux/nfs3.h> | 3 | #include <linux/nfs3.h> |
| 4 | #include <linux/nfs_fs.h> | 4 | #include <linux/nfs_fs.h> |
| 5 | #include <linux/xattr_acl.h> | 5 | #include <linux/posix_acl_xattr.h> |
| 6 | #include <linux/nfsacl.h> | 6 | #include <linux/nfsacl.h> |
| 7 | 7 | ||
| 8 | #define NFSDBG_FACILITY NFSDBG_PROC | 8 | #define NFSDBG_FACILITY NFSDBG_PROC |
| @@ -53,9 +53,9 @@ ssize_t nfs3_getxattr(struct dentry *dentry, const char *name, | |||
| 53 | struct posix_acl *acl; | 53 | struct posix_acl *acl; |
| 54 | int type, error = 0; | 54 | int type, error = 0; |
| 55 | 55 | ||
| 56 | if (strcmp(name, XATTR_NAME_ACL_ACCESS) == 0) | 56 | if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) |
| 57 | type = ACL_TYPE_ACCESS; | 57 | type = ACL_TYPE_ACCESS; |
| 58 | else if (strcmp(name, XATTR_NAME_ACL_DEFAULT) == 0) | 58 | else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) |
| 59 | type = ACL_TYPE_DEFAULT; | 59 | type = ACL_TYPE_DEFAULT; |
| 60 | else | 60 | else |
| 61 | return -EOPNOTSUPP; | 61 | return -EOPNOTSUPP; |
| @@ -82,9 +82,9 @@ int nfs3_setxattr(struct dentry *dentry, const char *name, | |||
| 82 | struct posix_acl *acl; | 82 | struct posix_acl *acl; |
| 83 | int type, error; | 83 | int type, error; |
| 84 | 84 | ||
| 85 | if (strcmp(name, XATTR_NAME_ACL_ACCESS) == 0) | 85 | if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) |
| 86 | type = ACL_TYPE_ACCESS; | 86 | type = ACL_TYPE_ACCESS; |
| 87 | else if (strcmp(name, XATTR_NAME_ACL_DEFAULT) == 0) | 87 | else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) |
| 88 | type = ACL_TYPE_DEFAULT; | 88 | type = ACL_TYPE_DEFAULT; |
| 89 | else | 89 | else |
| 90 | return -EOPNOTSUPP; | 90 | return -EOPNOTSUPP; |
| @@ -103,9 +103,9 @@ int nfs3_removexattr(struct dentry *dentry, const char *name) | |||
| 103 | struct inode *inode = dentry->d_inode; | 103 | struct inode *inode = dentry->d_inode; |
| 104 | int type; | 104 | int type; |
| 105 | 105 | ||
| 106 | if (strcmp(name, XATTR_NAME_ACL_ACCESS) == 0) | 106 | if (strcmp(name, POSIX_ACL_XATTR_ACCESS) == 0) |
| 107 | type = ACL_TYPE_ACCESS; | 107 | type = ACL_TYPE_ACCESS; |
| 108 | else if (strcmp(name, XATTR_NAME_ACL_DEFAULT) == 0) | 108 | else if (strcmp(name, POSIX_ACL_XATTR_DEFAULT) == 0) |
| 109 | type = ACL_TYPE_DEFAULT; | 109 | type = ACL_TYPE_DEFAULT; |
| 110 | else | 110 | else |
| 111 | return -EOPNOTSUPP; | 111 | return -EOPNOTSUPP; |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index de340ffd33c3..be24ead89d94 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
| @@ -46,10 +46,9 @@ | |||
| 46 | #include <linux/nfsd/nfsfh.h> | 46 | #include <linux/nfsd/nfsfh.h> |
| 47 | #include <linux/quotaops.h> | 47 | #include <linux/quotaops.h> |
| 48 | #include <linux/dnotify.h> | 48 | #include <linux/dnotify.h> |
| 49 | #include <linux/xattr_acl.h> | ||
| 50 | #include <linux/posix_acl.h> | 49 | #include <linux/posix_acl.h> |
| 51 | #ifdef CONFIG_NFSD_V4 | ||
| 52 | #include <linux/posix_acl_xattr.h> | 50 | #include <linux/posix_acl_xattr.h> |
| 51 | #ifdef CONFIG_NFSD_V4 | ||
| 53 | #include <linux/xattr.h> | 52 | #include <linux/xattr.h> |
| 54 | #include <linux/nfs4.h> | 53 | #include <linux/nfs4.h> |
| 55 | #include <linux/nfs4_acl.h> | 54 | #include <linux/nfs4_acl.h> |
| @@ -1872,10 +1871,10 @@ nfsd_get_posix_acl(struct svc_fh *fhp, int type) | |||
| 1872 | return ERR_PTR(-EOPNOTSUPP); | 1871 | return ERR_PTR(-EOPNOTSUPP); |
| 1873 | switch(type) { | 1872 | switch(type) { |
| 1874 | case ACL_TYPE_ACCESS: | 1873 | case ACL_TYPE_ACCESS: |
| 1875 | name = XATTR_NAME_ACL_ACCESS; | 1874 | name = POSIX_ACL_XATTR_ACCESS; |
| 1876 | break; | 1875 | break; |
| 1877 | case ACL_TYPE_DEFAULT: | 1876 | case ACL_TYPE_DEFAULT: |
| 1878 | name = XATTR_NAME_ACL_DEFAULT; | 1877 | name = POSIX_ACL_XATTR_DEFAULT; |
| 1879 | break; | 1878 | break; |
| 1880 | default: | 1879 | default: |
| 1881 | return ERR_PTR(-EOPNOTSUPP); | 1880 | return ERR_PTR(-EOPNOTSUPP); |
| @@ -1919,17 +1918,17 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl) | |||
| 1919 | return -EOPNOTSUPP; | 1918 | return -EOPNOTSUPP; |
| 1920 | switch(type) { | 1919 | switch(type) { |
| 1921 | case ACL_TYPE_ACCESS: | 1920 | case ACL_TYPE_ACCESS: |
| 1922 | name = XATTR_NAME_ACL_ACCESS; | 1921 | name = POSIX_ACL_XATTR_ACCESS; |
| 1923 | break; | 1922 | break; |
| 1924 | case ACL_TYPE_DEFAULT: | 1923 | case ACL_TYPE_DEFAULT: |
| 1925 | name = XATTR_NAME_ACL_DEFAULT; | 1924 | name = POSIX_ACL_XATTR_DEFAULT; |
| 1926 | break; | 1925 | break; |
| 1927 | default: | 1926 | default: |
| 1928 | return -EOPNOTSUPP; | 1927 | return -EOPNOTSUPP; |
| 1929 | } | 1928 | } |
| 1930 | 1929 | ||
| 1931 | if (acl && acl->a_count) { | 1930 | if (acl && acl->a_count) { |
| 1932 | size = xattr_acl_size(acl->a_count); | 1931 | size = posix_acl_xattr_size(acl->a_count); |
| 1933 | value = kmalloc(size, GFP_KERNEL); | 1932 | value = kmalloc(size, GFP_KERNEL); |
| 1934 | if (!value) | 1933 | if (!value) |
| 1935 | return -ENOMEM; | 1934 | return -ENOMEM; |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 94dc42475a04..76caedf737f2 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
| @@ -36,10 +36,16 @@ int reiserfs_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
| 36 | /* following two cases are taken from fs/ext2/ioctl.c by Remy | 36 | /* following two cases are taken from fs/ext2/ioctl.c by Remy |
| 37 | Card (card@masi.ibp.fr) */ | 37 | Card (card@masi.ibp.fr) */ |
| 38 | case REISERFS_IOC_GETFLAGS: | 38 | case REISERFS_IOC_GETFLAGS: |
| 39 | if (!reiserfs_attrs (inode->i_sb)) | ||
| 40 | return -ENOTTY; | ||
| 41 | |||
| 39 | flags = REISERFS_I(inode) -> i_attrs; | 42 | flags = REISERFS_I(inode) -> i_attrs; |
| 40 | i_attrs_to_sd_attrs( inode, ( __u16 * ) &flags ); | 43 | i_attrs_to_sd_attrs( inode, ( __u16 * ) &flags ); |
| 41 | return put_user(flags, (int __user *) arg); | 44 | return put_user(flags, (int __user *) arg); |
| 42 | case REISERFS_IOC_SETFLAGS: { | 45 | case REISERFS_IOC_SETFLAGS: { |
| 46 | if (!reiserfs_attrs (inode->i_sb)) | ||
| 47 | return -ENOTTY; | ||
| 48 | |||
| 43 | if (IS_RDONLY(inode)) | 49 | if (IS_RDONLY(inode)) |
| 44 | return -EROFS; | 50 | return -EROFS; |
| 45 | 51 | ||
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 7b87707acc36..d1bcf0da6728 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
| @@ -645,18 +645,22 @@ struct buffer_chunk { | |||
| 645 | 645 | ||
| 646 | static void write_chunk(struct buffer_chunk *chunk) { | 646 | static void write_chunk(struct buffer_chunk *chunk) { |
| 647 | int i; | 647 | int i; |
| 648 | get_fs_excl(); | ||
| 648 | for (i = 0; i < chunk->nr ; i++) { | 649 | for (i = 0; i < chunk->nr ; i++) { |
| 649 | submit_logged_buffer(chunk->bh[i]) ; | 650 | submit_logged_buffer(chunk->bh[i]) ; |
| 650 | } | 651 | } |
| 651 | chunk->nr = 0; | 652 | chunk->nr = 0; |
| 653 | put_fs_excl(); | ||
| 652 | } | 654 | } |
| 653 | 655 | ||
| 654 | static void write_ordered_chunk(struct buffer_chunk *chunk) { | 656 | static void write_ordered_chunk(struct buffer_chunk *chunk) { |
| 655 | int i; | 657 | int i; |
| 658 | get_fs_excl(); | ||
| 656 | for (i = 0; i < chunk->nr ; i++) { | 659 | for (i = 0; i < chunk->nr ; i++) { |
| 657 | submit_ordered_buffer(chunk->bh[i]) ; | 660 | submit_ordered_buffer(chunk->bh[i]) ; |
| 658 | } | 661 | } |
| 659 | chunk->nr = 0; | 662 | chunk->nr = 0; |
| 663 | put_fs_excl(); | ||
| 660 | } | 664 | } |
| 661 | 665 | ||
| 662 | static int add_to_chunk(struct buffer_chunk *chunk, struct buffer_head *bh, | 666 | static int add_to_chunk(struct buffer_chunk *chunk, struct buffer_head *bh, |
| @@ -918,6 +922,8 @@ static int flush_commit_list(struct super_block *s, struct reiserfs_journal_list | |||
| 918 | return 0 ; | 922 | return 0 ; |
| 919 | } | 923 | } |
| 920 | 924 | ||
| 925 | get_fs_excl(); | ||
| 926 | |||
| 921 | /* before we can put our commit blocks on disk, we have to make sure everyone older than | 927 | /* before we can put our commit blocks on disk, we have to make sure everyone older than |
| 922 | ** us is on disk too | 928 | ** us is on disk too |
| 923 | */ | 929 | */ |
| @@ -1055,6 +1061,7 @@ put_jl: | |||
| 1055 | 1061 | ||
| 1056 | if (retval) | 1062 | if (retval) |
| 1057 | reiserfs_abort (s, retval, "Journal write error in %s", __FUNCTION__); | 1063 | reiserfs_abort (s, retval, "Journal write error in %s", __FUNCTION__); |
| 1064 | put_fs_excl(); | ||
| 1058 | return retval; | 1065 | return retval; |
| 1059 | } | 1066 | } |
| 1060 | 1067 | ||
| @@ -1251,6 +1258,8 @@ static int flush_journal_list(struct super_block *s, | |||
| 1251 | return 0 ; | 1258 | return 0 ; |
| 1252 | } | 1259 | } |
| 1253 | 1260 | ||
| 1261 | get_fs_excl(); | ||
| 1262 | |||
| 1254 | /* if all the work is already done, get out of here */ | 1263 | /* if all the work is already done, get out of here */ |
| 1255 | if (atomic_read(&(jl->j_nonzerolen)) <= 0 && | 1264 | if (atomic_read(&(jl->j_nonzerolen)) <= 0 && |
| 1256 | atomic_read(&(jl->j_commit_left)) <= 0) { | 1265 | atomic_read(&(jl->j_commit_left)) <= 0) { |
| @@ -1450,6 +1459,7 @@ flush_older_and_return: | |||
| 1450 | put_journal_list(s, jl); | 1459 | put_journal_list(s, jl); |
| 1451 | if (flushall) | 1460 | if (flushall) |
| 1452 | up(&journal->j_flush_sem); | 1461 | up(&journal->j_flush_sem); |
| 1462 | put_fs_excl(); | ||
| 1453 | return err ; | 1463 | return err ; |
| 1454 | } | 1464 | } |
| 1455 | 1465 | ||
| @@ -2719,6 +2729,7 @@ relock: | |||
| 2719 | th->t_trans_id = journal->j_trans_id ; | 2729 | th->t_trans_id = journal->j_trans_id ; |
| 2720 | unlock_journal(p_s_sb) ; | 2730 | unlock_journal(p_s_sb) ; |
| 2721 | INIT_LIST_HEAD (&th->t_list); | 2731 | INIT_LIST_HEAD (&th->t_list); |
| 2732 | get_fs_excl(); | ||
| 2722 | return 0 ; | 2733 | return 0 ; |
| 2723 | 2734 | ||
| 2724 | out_fail: | 2735 | out_fail: |
| @@ -3526,6 +3537,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, struct super_b | |||
| 3526 | BUG_ON (th->t_refcount > 1); | 3537 | BUG_ON (th->t_refcount > 1); |
| 3527 | BUG_ON (!th->t_trans_id); | 3538 | BUG_ON (!th->t_trans_id); |
| 3528 | 3539 | ||
| 3540 | put_fs_excl(); | ||
| 3529 | current->journal_info = th->t_handle_save; | 3541 | current->journal_info = th->t_handle_save; |
| 3530 | reiserfs_check_lock_depth(p_s_sb, "journal end"); | 3542 | reiserfs_check_lock_depth(p_s_sb, "journal end"); |
| 3531 | if (journal->j_len == 0) { | 3543 | if (journal->j_len == 0) { |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 660aefca1fd2..4b80ab95d338 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
| @@ -1053,10 +1053,9 @@ static void handle_barrier_mode(struct super_block *s, unsigned long bits) { | |||
| 1053 | 1053 | ||
| 1054 | static void handle_attrs( struct super_block *s ) | 1054 | static void handle_attrs( struct super_block *s ) |
| 1055 | { | 1055 | { |
| 1056 | struct reiserfs_super_block * rs; | 1056 | struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s); |
| 1057 | 1057 | ||
| 1058 | if( reiserfs_attrs( s ) ) { | 1058 | if( reiserfs_attrs( s ) ) { |
| 1059 | rs = SB_DISK_SUPER_BLOCK (s); | ||
| 1060 | if( old_format_only(s) ) { | 1059 | if( old_format_only(s) ) { |
| 1061 | reiserfs_warning(s, "reiserfs: cannot support attributes on 3.5.x disk format" ); | 1060 | reiserfs_warning(s, "reiserfs: cannot support attributes on 3.5.x disk format" ); |
| 1062 | REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS ); | 1061 | REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS ); |
| @@ -1066,6 +1065,8 @@ static void handle_attrs( struct super_block *s ) | |||
| 1066 | reiserfs_warning(s, "reiserfs: cannot support attributes until flag is set in super-block" ); | 1065 | reiserfs_warning(s, "reiserfs: cannot support attributes until flag is set in super-block" ); |
| 1067 | REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS ); | 1066 | REISERFS_SB(s) -> s_mount_opt &= ~ ( 1 << REISERFS_ATTRS ); |
| 1068 | } | 1067 | } |
| 1068 | } else if (le32_to_cpu( rs -> s_flags ) & reiserfs_attrs_cleared) { | ||
| 1069 | REISERFS_SB(s)->s_mount_opt |= REISERFS_ATTRS; | ||
| 1069 | } | 1070 | } |
| 1070 | } | 1071 | } |
| 1071 | 1072 | ||
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 3f6dc7112bc6..ac191ed7df0a 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
| @@ -159,14 +159,12 @@ udf_find_entry(struct inode *dir, struct dentry *dentry, | |||
| 159 | char *nameptr; | 159 | char *nameptr; |
| 160 | uint8_t lfi; | 160 | uint8_t lfi; |
| 161 | uint16_t liu; | 161 | uint16_t liu; |
| 162 | loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2; | 162 | loff_t size; |
| 163 | kernel_lb_addr bloc, eloc; | 163 | kernel_lb_addr bloc, eloc; |
| 164 | uint32_t extoffset, elen, offset; | 164 | uint32_t extoffset, elen, offset; |
| 165 | struct buffer_head *bh = NULL; | 165 | struct buffer_head *bh = NULL; |
| 166 | 166 | ||
| 167 | if (!dir) | 167 | size = (udf_ext0_offset(dir) + dir->i_size) >> 2; |
| 168 | return NULL; | ||
| 169 | |||
| 170 | f_pos = (udf_ext0_offset(dir) >> 2); | 168 | f_pos = (udf_ext0_offset(dir) >> 2); |
| 171 | 169 | ||
| 172 | fibh->soffset = fibh->eoffset = (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; | 170 | fibh->soffset = fibh->eoffset = (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2; |
