diff options
author | Michael Halcrow <mhalcrow@us.ibm.com> | 2008-02-06 04:38:32 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-06 13:41:12 -0500 |
commit | cc11beffdf80ca31dff21422fa2a5e54d25f1494 (patch) | |
tree | 3b0e28d18f493a7c59b089c4c6fc59c79945937e /fs/ecryptfs/mmap.c | |
parent | 7896b631823c6e8f1a520d89390624a51445840e (diff) |
eCryptfs: track header bytes rather than extents
Remove internal references to header extents; just keep track of header bytes
instead. Headers can easily span multiple pages with the recent persistent
file changes.
Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs/mmap.c')
-rw-r--r-- | fs/ecryptfs/mmap.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index 9a5e0d17f1c5..dc74b186145d 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c | |||
@@ -100,13 +100,14 @@ static void set_header_info(char *page_virt, | |||
100 | struct ecryptfs_crypt_stat *crypt_stat) | 100 | struct ecryptfs_crypt_stat *crypt_stat) |
101 | { | 101 | { |
102 | size_t written; | 102 | size_t written; |
103 | int save_num_header_extents_at_front = | 103 | size_t save_num_header_bytes_at_front = |
104 | crypt_stat->num_header_extents_at_front; | 104 | crypt_stat->num_header_bytes_at_front; |
105 | 105 | ||
106 | crypt_stat->num_header_extents_at_front = 1; | 106 | crypt_stat->num_header_bytes_at_front = |
107 | ECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE; | ||
107 | ecryptfs_write_header_metadata(page_virt + 20, crypt_stat, &written); | 108 | ecryptfs_write_header_metadata(page_virt + 20, crypt_stat, &written); |
108 | crypt_stat->num_header_extents_at_front = | 109 | crypt_stat->num_header_bytes_at_front = |
109 | save_num_header_extents_at_front; | 110 | save_num_header_bytes_at_front; |
110 | } | 111 | } |
111 | 112 | ||
112 | /** | 113 | /** |
@@ -132,8 +133,11 @@ ecryptfs_copy_up_encrypted_with_header(struct page *page, | |||
132 | loff_t view_extent_num = ((((loff_t)page->index) | 133 | loff_t view_extent_num = ((((loff_t)page->index) |
133 | * num_extents_per_page) | 134 | * num_extents_per_page) |
134 | + extent_num_in_page); | 135 | + extent_num_in_page); |
136 | size_t num_header_extents_at_front = | ||
137 | (crypt_stat->num_header_bytes_at_front | ||
138 | / crypt_stat->extent_size); | ||
135 | 139 | ||
136 | if (view_extent_num < crypt_stat->num_header_extents_at_front) { | 140 | if (view_extent_num < num_header_extents_at_front) { |
137 | /* This is a header extent */ | 141 | /* This is a header extent */ |
138 | char *page_virt; | 142 | char *page_virt; |
139 | 143 | ||
@@ -155,9 +159,8 @@ ecryptfs_copy_up_encrypted_with_header(struct page *page, | |||
155 | } else { | 159 | } else { |
156 | /* This is an encrypted data extent */ | 160 | /* This is an encrypted data extent */ |
157 | loff_t lower_offset = | 161 | loff_t lower_offset = |
158 | ((view_extent_num - | 162 | ((view_extent_num * crypt_stat->extent_size) |
159 | crypt_stat->num_header_extents_at_front) | 163 | - crypt_stat->num_header_bytes_at_front); |
160 | * crypt_stat->extent_size); | ||
161 | 164 | ||
162 | rc = ecryptfs_read_lower_page_segment( | 165 | rc = ecryptfs_read_lower_page_segment( |
163 | page, (lower_offset >> PAGE_CACHE_SHIFT), | 166 | page, (lower_offset >> PAGE_CACHE_SHIFT), |