[Ocfs2-tools-devel] [PATCH 1/5] tunefs.ocfs2: Warn if not using complete device

Goldwyn Rodrigues rgoldwyn at gmail.com
Thu Jan 12 20:32:32 PST 2012


Sunil,

Could you delay including these patches for a couple of days? I found
a couple of issues with the patches I sent last:

1. OCFS2_FEATURE_COMPAT_JBD2_SB in superblock may not be set for
block64 compatibility.
2. Typo in set_journal_block64_run (block32->block64)
3. tunefs.ocfs2 may accept number-of-blocks more than device block size.

I will send the fixed patches once I am sure the fixes work.

On Thu, Jan 12, 2012 at 3:40 PM, Sunil Mushran <sunil.mushran at oracle.com> wrote:
> Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
>
>
> On 12/22/2011 03:42 PM, Goldwyn Rodrigues wrote:
>>
>> Sample test case (for a device greater than 16TB):
>> 1. Format a device with blocksize 4k and block count<  16TB
>> 2. resize device (-S)
>> Results: Device is formatted to 16TB even if the device is bigger.
>>
>> The patch fails the tunefs.ocfs2 attempt and ask user to explicitly state
>> block-count to not use the complete device.
>>
>> Signed-off-by: Goldwyn Rodrigues<rgoldwyn at suse.de>
>> ---
>>  tunefs.ocfs2/op_resize_volume.c |   19 ++++++++++++++++---
>>  1 files changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/tunefs.ocfs2/op_resize_volume.c
>> b/tunefs.ocfs2/op_resize_volume.c
>> index 8541374..0426d41 100644
>> --- a/tunefs.ocfs2/op_resize_volume.c
>> +++ b/tunefs.ocfs2/op_resize_volume.c
>> @@ -535,10 +535,23 @@ static errcode_t check_new_size(ocfs2_filesys
>> *fs, uint64_t new_size,
>>        }
>>
>>        device_clusters = device_blocks>>  b_to_c_bits;
>> -       if (device_clusters>  UINT32_MAX)
>> -               device_clusters = UINT32_MAX;
>> -       if (!try_clusters)
>> +
>> +       if (!try_clusters) {
>> +               if (device_clusters>  UINT32_MAX) {
>> +                       verbosef(VL_APP,
>> +                               "Device clusters (%"PRIu64" is greater
>> than "
>> +                               "maximum possible clusters %"PRIu32"\n",
>> +                               device_clusters, UINT32_MAX);
>> +                       try_blocks = UINT32_MAX<<  b_to_c_bits;
>> +                       errorf("Device clusters %"PRIu64" is greater than
>> %"
>> +                               PRIu32".\nIf you want to resize to
>> %"PRIu64
>> +                               " blocks please specify %"PRIu64" as "
>> +                               "blocks-count.\n", device_clusters,
>> +                               UINT32_MAX, try_blocks, try_blocks);
>> +                       return TUNEFS_ET_INVALID_NUMBER;
>> +               }
>>                try_clusters = device_clusters;
>> +       }
>>        try_blocks = try_clusters<<  b_to_c_bits;
>>
>>        /* Now we're guaranteed that try_clusters is within range */
>
>



-- 
Goldwyn



More information about the Ocfs2-tools-devel mailing list