[Ocfs2-tools-devel] [PATCH 18/22] tunefs rework: Add feature_sparse_files.c

Joel Becker Joel.Becker at oracle.com
Thu Jul 31 22:30:10 PDT 2008


On Fri, Aug 01, 2008 at 11:22:21AM +0800, Tao Ma wrote:
> Joel Becker wrote:
>> Enable and disable the sparse file feature.
>> This is the 'sparse' key to the tunefs option '--fs-features'.
>> Signed-off-by: Joel Becker <joel.becker at oracle.com>
>> ---
>
>> +static errcode_t get_total_free_clusters(ocfs2_filesys *fs,
>> +					 uint32_t *clusters)
> This function and "empty_clusters" shows up in patch 17. So could you 
> please abstract them out to be non-static?

	You're right, these could be in libo2ne.

>> +static int disable_sparse_files(ocfs2_filesys *fs, int flags)
>> +{
>> +	errcode_t ret = 0;
>> +	struct ocfs2_super_block *super = OCFS2_RAW_SB(fs->fs_super);
>> +	struct fill_hole_context ctxt;
>> +
>> +	if (!ocfs2_sparse_alloc(super)) {
>> +		verbosef(VL_APP,
>> +			 "Sparse file feature is not enabled; "
>> +			 "nothing to disable\n");
>> +		goto out;
>> +	}
>> +
>> +	if (ocfs2_writes_unwritten_extents(super)) {
>> +		errorf("Unwritten extents are enabled on device \"%s\"; "
>> +		       "sparse files cannot be disabled\n",
>> +		       fs->fs_devname);
>> +		ret = TUNEFS_ET_UNWRITTEN_PRESENT;
>> +		goto out;
>> +	}
> I remembered that if the user want to remove "sparse", unwritten is removed 
> automatically by you now, right? So if we hit here, we may meet with a bug 
> in tunefs. So should we say something loudly other than this?

	It's not a bug if they are running in interactive mode.  They
will first be asked "disable unwritten extents?"  If they say yes, all
is well, but if they say know, they get to this check.

Joel

-- 

"But all my words come back to me
 In shades of mediocrity.
 Like emptiness in harmony
 I need someone to comfort me."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127



More information about the Ocfs2-tools-devel mailing list