diff options
Diffstat (limited to 'fs/buffer.c')
-rw-r--r-- | fs/buffer.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/fs/buffer.c b/fs/buffer.c index aecd057cd0e0..aa68206bd517 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -981,7 +981,8 @@ grow_dev_page(struct block_device *bdev, sector_t block, | |||
981 | struct page *page; | 981 | struct page *page; |
982 | struct buffer_head *bh; | 982 | struct buffer_head *bh; |
983 | 983 | ||
984 | page = find_or_create_page(inode->i_mapping, index, GFP_NOFS); | 984 | page = find_or_create_page(inode->i_mapping, index, |
985 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); | ||
985 | if (!page) | 986 | if (!page) |
986 | return NULL; | 987 | return NULL; |
987 | 988 | ||
@@ -2100,7 +2101,7 @@ int cont_prepare_write(struct page *page, unsigned offset, | |||
2100 | PAGE_CACHE_SIZE, get_block); | 2101 | PAGE_CACHE_SIZE, get_block); |
2101 | if (status) | 2102 | if (status) |
2102 | goto out_unmap; | 2103 | goto out_unmap; |
2103 | zero_user_page(page, zerofrom, PAGE_CACHE_SIZE - zerofrom, | 2104 | zero_user_page(new_page, zerofrom, PAGE_CACHE_SIZE - zerofrom, |
2104 | KM_USER0); | 2105 | KM_USER0); |
2105 | generic_commit_write(NULL, new_page, zerofrom, PAGE_CACHE_SIZE); | 2106 | generic_commit_write(NULL, new_page, zerofrom, PAGE_CACHE_SIZE); |
2106 | unlock_page(new_page); | 2107 | unlock_page(new_page); |
@@ -2898,8 +2899,9 @@ static void recalc_bh_state(void) | |||
2898 | 2899 | ||
2899 | struct buffer_head *alloc_buffer_head(gfp_t gfp_flags) | 2900 | struct buffer_head *alloc_buffer_head(gfp_t gfp_flags) |
2900 | { | 2901 | { |
2901 | struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags); | 2902 | struct buffer_head *ret = kmem_cache_zalloc(bh_cachep, gfp_flags); |
2902 | if (ret) { | 2903 | if (ret) { |
2904 | INIT_LIST_HEAD(&ret->b_assoc_buffers); | ||
2903 | get_cpu_var(bh_accounting).nr++; | 2905 | get_cpu_var(bh_accounting).nr++; |
2904 | recalc_bh_state(); | 2906 | recalc_bh_state(); |
2905 | put_cpu_var(bh_accounting); | 2907 | put_cpu_var(bh_accounting); |
@@ -2918,17 +2920,6 @@ void free_buffer_head(struct buffer_head *bh) | |||
2918 | } | 2920 | } |
2919 | EXPORT_SYMBOL(free_buffer_head); | 2921 | EXPORT_SYMBOL(free_buffer_head); |
2920 | 2922 | ||
2921 | static void | ||
2922 | init_buffer_head(void *data, struct kmem_cache *cachep, unsigned long flags) | ||
2923 | { | ||
2924 | if (flags & SLAB_CTOR_CONSTRUCTOR) { | ||
2925 | struct buffer_head * bh = (struct buffer_head *)data; | ||
2926 | |||
2927 | memset(bh, 0, sizeof(*bh)); | ||
2928 | INIT_LIST_HEAD(&bh->b_assoc_buffers); | ||
2929 | } | ||
2930 | } | ||
2931 | |||
2932 | static void buffer_exit_cpu(int cpu) | 2923 | static void buffer_exit_cpu(int cpu) |
2933 | { | 2924 | { |
2934 | int i; | 2925 | int i; |
@@ -2955,12 +2946,8 @@ void __init buffer_init(void) | |||
2955 | { | 2946 | { |
2956 | int nrpages; | 2947 | int nrpages; |
2957 | 2948 | ||
2958 | bh_cachep = kmem_cache_create("buffer_head", | 2949 | bh_cachep = KMEM_CACHE(buffer_head, |
2959 | sizeof(struct buffer_head), 0, | 2950 | SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD); |
2960 | (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC| | ||
2961 | SLAB_MEM_SPREAD), | ||
2962 | init_buffer_head, | ||
2963 | NULL); | ||
2964 | 2951 | ||
2965 | /* | 2952 | /* |
2966 | * Limit the bh occupancy to 10% of ZONE_NORMAL | 2953 | * Limit the bh occupancy to 10% of ZONE_NORMAL |