Add "add-gfp-version-for-sb_getblk" and "use-sb_get_gfp" patches
[ext4-patch-queue.git] / add-gfp-version-for-sb_getblk
blobffc2541be91f3426f46ef4e7f4d10e02f5ce978f
1 bufferhead: Add _gfp version for sb_getblk()
3 From: Nikolay Borisov <kernel@kyup.com>
5 sb_getblk() is used during ext4 (and possibly other FSes) writeback
6 paths. Sometimes such path require allocating memory and guaranteeing
7 that such allocation won't block. Currently, however, there is no way
8 to provide user flags for sb_getblk which could lead to deadlocks.
10 This patch implements a sb_getblk_gfp with the only difference it can
11 accept user-provided GFP flags.
13 Signed-off-by: Nikolay Borisov <kernel@kyup.com>
14 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
15 Cc: stable@vger.kernel.org
16 ---
18 As per the discussion in this thread (http://marc.info/?l=linux-ext4&m=143563347324528&w=2)
19 here are the patches which hopefully implement Ted's suggestion. 
21  include/linux/buffer_head.h |    7 +++++++
22  1 files changed, 7 insertions(+), 0 deletions(-)
24 diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
25 index 73b4522..e6797de 100644
26 --- a/include/linux/buffer_head.h
27 +++ b/include/linux/buffer_head.h
28 @@ -317,6 +317,13 @@ sb_getblk(struct super_block *sb, sector_t block)
29         return __getblk_gfp(sb->s_bdev, block, sb->s_blocksize, __GFP_MOVABLE);
30  }
33 +static inline struct buffer_head *
34 +sb_getblk_gfp(struct super_block *sb, sector_t block, gfp_t gfp)
36 +       return __getblk_gfp(sb->s_bdev, block, sb->s_blocksize, gfp);
39  static inline struct buffer_head *
40  sb_find_get_block(struct super_block *sb, sector_t block)
41  {
42 -- 
43 1.7.1