diff options
Diffstat (limited to 'fs/ufs/util.c')
-rw-r--r-- | fs/ufs/util.c | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/fs/ufs/util.c b/fs/ufs/util.c index 59acc8f073ac..a2f13f45708b 100644 --- a/fs/ufs/util.c +++ b/fs/ufs/util.c | |||
@@ -14,15 +14,6 @@ | |||
14 | #include "swab.h" | 14 | #include "swab.h" |
15 | #include "util.h" | 15 | #include "util.h" |
16 | 16 | ||
17 | #undef UFS_UTILS_DEBUG | ||
18 | |||
19 | #ifdef UFS_UTILS_DEBUG | ||
20 | #define UFSD(x) printk("(%s, %d), %s: ", __FILE__, __LINE__, __FUNCTION__); printk x; | ||
21 | #else | ||
22 | #define UFSD(x) | ||
23 | #endif | ||
24 | |||
25 | |||
26 | struct ufs_buffer_head * _ubh_bread_ (struct ufs_sb_private_info * uspi, | 17 | struct ufs_buffer_head * _ubh_bread_ (struct ufs_sb_private_info * uspi, |
27 | struct super_block *sb, u64 fragment, u64 size) | 18 | struct super_block *sb, u64 fragment, u64 size) |
28 | { | 19 | { |
@@ -63,17 +54,17 @@ struct ufs_buffer_head * ubh_bread_uspi (struct ufs_sb_private_info * uspi, | |||
63 | count = size >> uspi->s_fshift; | 54 | count = size >> uspi->s_fshift; |
64 | if (count <= 0 || count > UFS_MAXFRAG) | 55 | if (count <= 0 || count > UFS_MAXFRAG) |
65 | return NULL; | 56 | return NULL; |
66 | USPI_UBH->fragment = fragment; | 57 | USPI_UBH(uspi)->fragment = fragment; |
67 | USPI_UBH->count = count; | 58 | USPI_UBH(uspi)->count = count; |
68 | for (i = 0; i < count; i++) | 59 | for (i = 0; i < count; i++) |
69 | if (!(USPI_UBH->bh[i] = sb_bread(sb, fragment + i))) | 60 | if (!(USPI_UBH(uspi)->bh[i] = sb_bread(sb, fragment + i))) |
70 | goto failed; | 61 | goto failed; |
71 | for (; i < UFS_MAXFRAG; i++) | 62 | for (; i < UFS_MAXFRAG; i++) |
72 | USPI_UBH->bh[i] = NULL; | 63 | USPI_UBH(uspi)->bh[i] = NULL; |
73 | return USPI_UBH; | 64 | return USPI_UBH(uspi); |
74 | failed: | 65 | failed: |
75 | for (j = 0; j < i; j++) | 66 | for (j = 0; j < i; j++) |
76 | brelse (USPI_UBH->bh[j]); | 67 | brelse (USPI_UBH(uspi)->bh[j]); |
77 | return NULL; | 68 | return NULL; |
78 | } | 69 | } |
79 | 70 | ||
@@ -90,11 +81,11 @@ void ubh_brelse (struct ufs_buffer_head * ubh) | |||
90 | void ubh_brelse_uspi (struct ufs_sb_private_info * uspi) | 81 | void ubh_brelse_uspi (struct ufs_sb_private_info * uspi) |
91 | { | 82 | { |
92 | unsigned i; | 83 | unsigned i; |
93 | if (!USPI_UBH) | 84 | if (!USPI_UBH(uspi)) |
94 | return; | 85 | return; |
95 | for ( i = 0; i < USPI_UBH->count; i++ ) { | 86 | for ( i = 0; i < USPI_UBH(uspi)->count; i++ ) { |
96 | brelse (USPI_UBH->bh[i]); | 87 | brelse (USPI_UBH(uspi)->bh[i]); |
97 | USPI_UBH->bh[i] = NULL; | 88 | USPI_UBH(uspi)->bh[i] = NULL; |
98 | } | 89 | } |
99 | } | 90 | } |
100 | 91 | ||
@@ -121,13 +112,12 @@ void ubh_mark_buffer_uptodate (struct ufs_buffer_head * ubh, int flag) | |||
121 | } | 112 | } |
122 | } | 113 | } |
123 | 114 | ||
124 | void ubh_ll_rw_block (int rw, unsigned nr, struct ufs_buffer_head * ubh[]) | 115 | void ubh_ll_rw_block(int rw, struct ufs_buffer_head *ubh) |
125 | { | 116 | { |
126 | unsigned i; | ||
127 | if (!ubh) | 117 | if (!ubh) |
128 | return; | 118 | return; |
129 | for ( i = 0; i < nr; i++ ) | 119 | |
130 | ll_rw_block (rw, ubh[i]->count, ubh[i]->bh); | 120 | ll_rw_block(rw, ubh->count, ubh->bh); |
131 | } | 121 | } |
132 | 122 | ||
133 | void ubh_wait_on_buffer (struct ufs_buffer_head * ubh) | 123 | void ubh_wait_on_buffer (struct ufs_buffer_head * ubh) |
@@ -139,18 +129,6 @@ void ubh_wait_on_buffer (struct ufs_buffer_head * ubh) | |||
139 | wait_on_buffer (ubh->bh[i]); | 129 | wait_on_buffer (ubh->bh[i]); |
140 | } | 130 | } |
141 | 131 | ||
142 | unsigned ubh_max_bcount (struct ufs_buffer_head * ubh) | ||
143 | { | ||
144 | unsigned i; | ||
145 | unsigned max = 0; | ||
146 | if (!ubh) | ||
147 | return 0; | ||
148 | for ( i = 0; i < ubh->count; i++ ) | ||
149 | if ( atomic_read(&ubh->bh[i]->b_count) > max ) | ||
150 | max = atomic_read(&ubh->bh[i]->b_count); | ||
151 | return max; | ||
152 | } | ||
153 | |||
154 | void ubh_bforget (struct ufs_buffer_head * ubh) | 132 | void ubh_bforget (struct ufs_buffer_head * ubh) |
155 | { | 133 | { |
156 | unsigned i; | 134 | unsigned i; |