* Online defragmentation
@ 2007-05-30 7:04 Aneesh Kumar K.V
2007-05-30 7:48 ` Aneesh Kumar K.V
2007-05-30 14:10 ` Andreas Dilger
0 siblings, 2 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2007-05-30 7:04 UTC (permalink / raw)
To: Takashi Sato; +Cc: linux-ext4
Hi Takashi,
I was looking at online defrag code and found that the tmp_inode is
created with tmp_inode->i_nlink equal to zero. Now i am not sure whether
i understand the code correctly, but AFAIU we allocate contiguous block
using this tmp_inode. That means tmp_inode have extent details
corresponding to the blocks. Now we are mapping the file data found in
the original inode to this new blocks. Towards the end we does a iput.
In iput since we have i_nlink as zero it will go ahead and call
generic_delete_inode which will cause these data blocks to be marked
free (right ?)
I haven't tested the defrag code. This came up when i was doing the
online migration. With large file having large number of fragmented
blocks I was getting the below error during the iput of the temporary
inode.
"ext4_free_blocks Freeing blocks not in datazone ...."
I was able to fix that by setting i_nlink = 1 which will cause the
generic_forget_inode to be called
-aneesh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Online defragmentation
2007-05-30 7:04 Online defragmentation Aneesh Kumar K.V
@ 2007-05-30 7:48 ` Aneesh Kumar K.V
2007-05-31 4:05 ` Takashi Sato
2007-05-30 14:10 ` Andreas Dilger
1 sibling, 1 reply; 4+ messages in thread
From: Aneesh Kumar K.V @ 2007-05-30 7:48 UTC (permalink / raw)
To: Takashi Sato; +Cc: linux-ext4
Aneesh Kumar K.V wrote:
> Hi Takashi,
>
> I was looking at online defrag code and found that the tmp_inode is
> created with tmp_inode->i_nlink equal to zero. Now i am not sure whether
> i understand the code correctly, but AFAIU we allocate contiguous block
> using this tmp_inode. That means tmp_inode have extent details
> corresponding to the blocks. Now we are mapping the file data found in
> the original inode to this new blocks. Towards the end we does a iput.
> In iput since we have i_nlink as zero it will go ahead and call
> generic_delete_inode which will cause these data blocks to be marked
> free (right ?)
>
Looking at the code again i guess for defragmentation it is okey. I
guess what actually happens is the blocks that is corresponding to the
original inode get accounted under tmp_inode. (it actually does a swap
of blocks ) So doing a iput with i_nlink = 0 is the correct approach.
Correct me if i am wrong.
Sorry for the noise.
-aneesh
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Online defragmentation
2007-05-30 7:48 ` Aneesh Kumar K.V
@ 2007-05-31 4:05 ` Takashi Sato
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Sato @ 2007-05-31 4:05 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: linux-ext4
Hi,
>> I was looking at online defrag code and found that the tmp_inode is created with
>> tmp_inode->i_nlink equal to zero. Now i am not sure whether i understand the code
>> correctly, but AFAIU we allocate contiguous block using this tmp_inode. That means
>> tmp_inode have extent details corresponding to the blocks. Now we are mapping the file
>> data found in the original inode to this new blocks. Towards the end we does a iput. In
>> iput since we have i_nlink as zero it will go ahead and call generic_delete_inode which
>> will cause these data blocks to be marked free (right ?)
>>
>
> Looking at the code again i guess for defragmentation it is okey. I guess what actually
> happens is the blocks that is corresponding to the original inode get accounted under
> tmp_inode. (it actually does a swap of blocks ) So doing a iput with i_nlink = 0 is the
> correct approach.
>
> Correct me if i am wrong.
Your understanding is right.
The iput() is called to free the old blocks which were in the original
inode.
Cheers, Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Online defragmentation
2007-05-30 7:04 Online defragmentation Aneesh Kumar K.V
2007-05-30 7:48 ` Aneesh Kumar K.V
@ 2007-05-30 14:10 ` Andreas Dilger
1 sibling, 0 replies; 4+ messages in thread
From: Andreas Dilger @ 2007-05-30 14:10 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: Takashi Sato, linux-ext4
On May 30, 2007 12:34 +0530, Aneesh Kumar K.V wrote:
> I haven't tested the defrag code. This came up when i was doing the
> online migration. With large file having large number of fragmented
> blocks I was getting the below error during the iput of the temporary
> inode.
>
> "ext4_free_blocks Freeing blocks not in datazone ...."
This shouldn't happen regardless of whether you are doing defrag or not,
since it will cause the filesystem to go read-only.
Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-05-31 4:05 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-30 7:04 Online defragmentation Aneesh Kumar K.V
2007-05-30 7:48 ` Aneesh Kumar K.V
2007-05-31 4:05 ` Takashi Sato
2007-05-30 14:10 ` Andreas Dilger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox