Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 39298
b: refs/heads/master
c: 471d401
h: refs/heads/master
v: v3
  • Loading branch information
Suparna Bhattacharya authored and Linus Torvalds committed Oct 11, 2006
1 parent 0887cbe commit 3e2d600
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f65e6fba163dfd0f962efb7d8f5528b6872e2b15
refs/heads/master: 471d4011a9862efff02094388b8fe8cd67683c38
16 changes: 16 additions & 0 deletions trunk/fs/ext4/extents.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,13 @@ ext4_can_extents_be_merged(struct inode *inode, struct ext4_extent *ex1,
!= le32_to_cpu(ex2->ee_block))
return 0;

/*
* To allow future support for preallocated extents to be added
* as an RO_COMPAT feature, refuse to merge to extents if
* can result in the top bit of ee_len being set
*/
if (le16_to_cpu(ex1->ee_len) + le16_to_cpu(ex2->ee_len) > EXT_MAX_LEN)
return 0;
#ifdef AGRESSIVE_TEST
if (le16_to_cpu(ex1->ee_len) >= 4)
return 0;
Expand Down Expand Up @@ -1944,6 +1951,15 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
unsigned long ee_block = le32_to_cpu(ex->ee_block);
ext4_fsblk_t ee_start = ext_pblock(ex);
unsigned short ee_len = le16_to_cpu(ex->ee_len);

/*
* Allow future support for preallocated extents to be added
* as an RO_COMPAT feature:
* Uninitialized extents are treated as holes, except that
* we avoid (fail) allocating new blocks during a write.
*/
if (ee_len > EXT_MAX_LEN)
goto out2;
/* if found exent covers block, simple return it */
if (iblock >= ee_block && iblock < ee_block + ee_len) {
newblock = iblock - ee_block + ee_start;
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/ext4_fs_extents.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ typedef int (*ext_prepare_callback)(struct inode *, struct ext4_ext_path *,

#define EXT_MAX_BLOCK 0xffffffff

#define EXT_MAX_LEN ((1UL << 15) - 1)


#define EXT_FIRST_EXTENT(__hdr__) \
((struct ext4_extent *) (((char *) (__hdr__)) + \
Expand Down

0 comments on commit 3e2d600

Please sign in to comment.