On 10.06.2012 11:08, Jean-Pierre André wrote:
> Hi,
> 
> Bogdan wrote:
>> On 08.06.2012 15:07, Jean-Pierre André wrote:
>>   
>>> Hi,
>>>
>>> Bogdan wrote:
>>>      
> 
> More on this :
> 
> I found a lot of time is spent in ntfs_rl_pread() and
> ntfs_rl_pwrite() because you feed them with the beginning
> of the runlist, and they have to search the relevant entry.
> You can avoid this by feeding them with the run which
> immediately follows the last hole encountered :
> 
> Before entering the loop :
> runlist_element *restart = na->rl;
> 
> At the end of loop (before rlc++) :
> if (rlc->lcn == LCN_HOLE) restart = rlc;
> 
> replace
> ret = ntfs_rl_pread(vol, na->rl, offset,...
> by
> ret = ntfs_rl_pread(vol, restart,
>     offset - (restart->vcn << vol->cluster_size_bits),...
> 
> replace
> ret = ntfs_rl_pwrite(vol, na->rl, 0, ...
> by
> ret = ntfs_rl_pwrite(vol, restart,
>     restart->vcn << vol->cluster_size_bits, ...
> 
> Also describe rlc and rlt as runlist_element*, they point at
> a run, not at the full runlist.

 Done (including the "+1" from your last mail). This also isn't my
code (I'm only using this function), but the changes were simple.

> In the same function, I see you are checking the tail
> in the loop (hence wiped multiple times)
> 
> size = na->allocated_size - na->data_size;
> etc.
> 
> There is a single tail, this should not be in a loop.

 Can't do that. The "size" and "offset" variables can be changed on
each iteration, so they have to be re-set to the correct values.

> In the main wipe_tail function, you only process the
> unnamed data attribute :
> 
> na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0);
> 
> But there can also be named data attributes, you should
> do a "while (!ntfs_attr_lookup(AT_DATA, ... ))"

 The ntfs_attr_lookup() function requires a ntfs_attr_search_ctx
variable, which can be obtained by calling
ntfs_attr_get_search_ctx(NULL, mft). But the "mft" comes from reading
the attribute, so we have to have it open already anyway, unless I'm
missing other methods to do this.

 I corrected the coding style (80-char line length limit and
parenthesis, the same as in other files), hope it's better now. You
should consider adding a make target to automatically correct the
files (with the "indent" utility, just like the SWIG project, which
I've recently encountered).

 New version of the full patch attached. I've removed the changes from
utils.c and layout.h. Apply over clean ntfs-3g_ntfsprogs-2012.1.15.

-- 
Pozdrawiam/Regards - Bogdan                     (GNU/Linux & FreeDOS)
Kurs asemblera x86 (DOS, GNU/Linux):http://rudy.mif.pg.gda.pl/~bogdro
Grupy dyskusyjne o asm:  pl.comp.lang.asm alt.pl.asm alt.pl.asm.win32
www.Xiph.org   www.TorProject.org   Soft (EN): miniurl.pl/bogdro-soft


Attachment: ntfs-fix-ntfswipe-v5.diff.gz
Description: GNU Zip compressed data

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to