block_validity.c (2d8ad8719591fa803b0d589ed057fa46f49b7155) block_validity.c (1f7d1e77419050831a905353683807fa69a26625)
1/*
2 * linux/fs/ext4/block_validity.c
3 *
4 * Copyright (C) 2009
5 * Theodore Ts'o (tytso@mit.edu)
6 *
7 * Track which blocks in the filesystem are metadata blocks that
8 * should never be used as data blocks by files or directories.

--- 232 unchanged lines hidden (view full) ---

241 else {
242 sbi->s_es->s_last_error_block = cpu_to_le64(start_blk);
243 return 0;
244 }
245 }
246 return 1;
247}
248
1/*
2 * linux/fs/ext4/block_validity.c
3 *
4 * Copyright (C) 2009
5 * Theodore Ts'o (tytso@mit.edu)
6 *
7 * Track which blocks in the filesystem are metadata blocks that
8 * should never be used as data blocks by files or directories.

--- 232 unchanged lines hidden (view full) ---

241 else {
242 sbi->s_es->s_last_error_block = cpu_to_le64(start_blk);
243 return 0;
244 }
245 }
246 return 1;
247}
248
249int ext4_check_blockref(const char *function, unsigned int line,
250 struct inode *inode, __le32 *p, unsigned int max)
251{
252 struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
253 __le32 *bref = p;
254 unsigned int blk;
255
256 while (bref < p+max) {
257 blk = le32_to_cpu(*bref++);
258 if (blk &&
259 unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb),
260 blk, 1))) {
261 es->s_last_error_block = cpu_to_le64(blk);
262 ext4_error_inode(inode, function, line, blk,
263 "invalid block");
264 return -EIO;
265 }
266 }
267 return 0;
268}