diff options
author | Steve French <sfrench@us.ibm.com> | 2006-03-31 03:35:56 +0000 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2006-03-31 03:35:56 +0000 |
commit | d62e54abca1146981fc9f98f85ff398a113a22c2 (patch) | |
tree | 870420dbc4c65e716dcef8a802aafdc0ef97a8b4 /fs/ntfs/runlist.c | |
parent | fd4a0b92db6a57cba8d03efbe1cebf91f9124ce0 (diff) | |
parent | ce362c009250340358a7221f3cdb7954cbf19c01 (diff) |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/ntfs/runlist.c')
-rw-r--r-- | fs/ntfs/runlist.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/ntfs/runlist.c b/fs/ntfs/runlist.c index 061b5ff6b73..eb52b801512 100644 --- a/fs/ntfs/runlist.c +++ b/fs/ntfs/runlist.c @@ -381,6 +381,7 @@ static inline runlist_element *ntfs_rl_insert(runlist_element *dst, static inline runlist_element *ntfs_rl_replace(runlist_element *dst, int dsize, runlist_element *src, int ssize, int loc) { + signed delta; BOOL left = FALSE; /* Left end of @src needs merging. */ BOOL right = FALSE; /* Right end of @src needs merging. */ int tail; /* Start of tail of @dst. */ @@ -396,11 +397,14 @@ static inline runlist_element *ntfs_rl_replace(runlist_element *dst, left = ntfs_are_rl_mergeable(dst + loc - 1, src); /* * Allocate some space. We will need less if the left, right, or both - * ends get merged. + * ends get merged. The -1 accounts for the run being replaced. */ - dst = ntfs_rl_realloc(dst, dsize, dsize + ssize - left - right); - if (IS_ERR(dst)) - return dst; + delta = ssize - 1 - left - right; + if (delta > 0) { + dst = ntfs_rl_realloc(dst, dsize, dsize + delta); + if (IS_ERR(dst)) + return dst; + } /* * We are guaranteed to succeed from here so can start modifying the * original runlists. |