@@ -212,6 +212,12 @@ extern const struct address_space_operations affs_aops_ofs;
212
212
extern const struct dentry_operations affs_dentry_operations ;
213
213
extern const struct dentry_operations affs_intl_dentry_operations ;
214
214
215
+ static inline bool affs_validblock (struct super_block * sb , int block )
216
+ {
217
+ return (block >= AFFS_SB (sb )-> s_reserved &&
218
+ block < AFFS_SB (sb )-> s_partition_size );
219
+ }
220
+
215
221
static inline void
216
222
affs_set_blocksize (struct super_block * sb , int size )
217
223
{
@@ -221,15 +227,15 @@ static inline struct buffer_head *
221
227
affs_bread (struct super_block * sb , int block )
222
228
{
223
229
pr_debug ("%s: %d\n" , __func__ , block );
224
- if (block >= AFFS_SB (sb ) -> s_reserved && block < AFFS_SB ( sb ) -> s_partition_size )
230
+ if (affs_validblock (sb , block ) )
225
231
return sb_bread (sb , block );
226
232
return NULL ;
227
233
}
228
234
static inline struct buffer_head *
229
235
affs_getblk (struct super_block * sb , int block )
230
236
{
231
237
pr_debug ("%s: %d\n" , __func__ , block );
232
- if (block >= AFFS_SB (sb ) -> s_reserved && block < AFFS_SB ( sb ) -> s_partition_size )
238
+ if (affs_validblock (sb , block ) )
233
239
return sb_getblk (sb , block );
234
240
return NULL ;
235
241
}
@@ -238,7 +244,7 @@ affs_getzeroblk(struct super_block *sb, int block)
238
244
{
239
245
struct buffer_head * bh ;
240
246
pr_debug ("%s: %d\n" , __func__ , block );
241
- if (block >= AFFS_SB (sb ) -> s_reserved && block < AFFS_SB ( sb ) -> s_partition_size ) {
247
+ if (affs_validblock (sb , block ) ) {
242
248
bh = sb_getblk (sb , block );
243
249
lock_buffer (bh );
244
250
memset (bh -> b_data , 0 , sb -> s_blocksize );
@@ -253,7 +259,7 @@ affs_getemptyblk(struct super_block *sb, int block)
253
259
{
254
260
struct buffer_head * bh ;
255
261
pr_debug ("%s: %d\n" , __func__ , block );
256
- if (block >= AFFS_SB (sb ) -> s_reserved && block < AFFS_SB ( sb ) -> s_partition_size ) {
262
+ if (affs_validblock (sb , block ) ) {
257
263
bh = sb_getblk (sb , block );
258
264
wait_on_buffer (bh );
259
265
set_buffer_uptodate (bh );
0 commit comments