-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreplace-ll_rw_block-with-other-functions.patch
94 lines (87 loc) · 2.76 KB
/
replace-ll_rw_block-with-other-functions.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Subject: [PATCH] ext4: replace ll_rw_block with other functions
From: Zheng Liu <[email protected]>
ll_rw_block() is deprecated. Thus we replace it with other functions.
CC: "Theodore Ts'o" <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Signed-off-by: Zheng Liu <[email protected]>
---
fs/ext4/inode.c | 14 +++++++-------
fs/ext4/namei.c | 9 ++++++---
fs/ext4/super.c | 11 ++++++-----
3 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index b3c243b..60aa2dd 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -787,9 +787,11 @@ struct buffer_head *ext4_bread(handle_t *handle, struct inode *inode,
bh = ext4_getblk(handle, inode, block, create, err);
if (!bh)
return bh;
- if (buffer_uptodate(bh))
+ if (bh_uptodate_or_lock(bh))
return bh;
- ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh);
+ get_bh(bh);
+ bh->b_end_io = end_buffer_read_sync;
+ submit_bh(READ | REQ_META | REQ_PRIO, bh);
wait_on_buffer(bh);
if (buffer_uptodate(bh))
return bh;
@@ -3416,12 +3418,10 @@ static int ext4_discard_partial_page_buffers_no_lock(handle_t *handle,
if (PageUptodate(page))
set_buffer_uptodate(bh);
- if (!buffer_uptodate(bh)) {
- err = -EIO;
- ll_rw_block(READ, 1, &bh);
- wait_on_buffer(bh);
+ if (!bh_uptodate_or_lock(bh)) {
+ err = bh_submit_read(bh);
/* Uhhuh. Read error. Complain and punt.*/
- if (!buffer_uptodate(bh))
+ if (err)
goto next;
}
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 6d600a6..35cc18f 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1228,9 +1228,12 @@ restart:
num++;
bh = ext4_getblk(NULL, dir, b++, 0, &err);
bh_use[ra_max] = bh;
- if (bh)
- ll_rw_block(READ | REQ_META | REQ_PRIO,
- 1, &bh);
+ if (bh && !bh_uptodate_or_lock(bh)) {
+ get_bh(bh);
+ bh->b_end_io = end_buffer_read_sync;
+ submit_bh(READ | REQ_META | REQ_PRIO,
+ bh);
+ }
}
}
if ((bh = bh_use[ra_ptr++]) == NULL)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 7265a03..bdfb66f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -4217,11 +4217,12 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
goto out_bdev;
}
journal->j_private = sb;
- ll_rw_block(READ, 1, &journal->j_sb_buffer);
- wait_on_buffer(journal->j_sb_buffer);
- if (!buffer_uptodate(journal->j_sb_buffer)) {
- ext4_msg(sb, KERN_ERR, "I/O error on journal device");
- goto out_journal;
+ if (!bh_uptodate_or_lock(journal->j_sb_buffer)) {
+ if (bh_submit_read(journal->j_sb_buffer)) {
+ ext4_msg(sb, KERN_ERR,
+ "I/O error on journal device");
+ goto out_journal;
+ }
}
if (be32_to_cpu(journal->j_superblock->s_nr_users) != 1) {
ext4_msg(sb, KERN_ERR, "External journal has more than one "
--
1.7.12.rc2.18.g61b472e