On Wed, Dec 28, 2016 at 5:16 PM, <marko.makela@mariadb.com> wrote:

diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 75efcdfdab0..095b9f706c0 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1179,10 +1179,11 @@ fil_crypt_start_encrypting_space(

                /* 3 - compute location to store crypt data */
                byte* frame = buf_block_get_frame(block);
-               ulint maxsize = 0;
                ut_ad(crypt_data);
-               crypt_data->page0_offset =
-                       fsp_header_get_crypt_offset(page_size, &maxsize);
+               crypt_data->page0_offset = FSP_HEADER_OFFSET
+                       + fsp_header_get_encryption_offset(page_size);
+               const ulint maxsize = page_size.logical()
+                       - crypt_data->page0_offset - FIL_PAGE_DATA_END;


This I do not like, why fsp_header_get_encryption_offset does not calculate the actual offset so that there is no need for adjustments? Now
every place where you call this you need to add FSP_HEADER_OFFSET to returned offset. Similarly for maxsize actually meaning
free space on the page. This is naturally technically correct, but is it maintainable?

R: Jan