acceleration of FAT writing

git-svn-id: svn://kolibrios.org@649 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2007-10-15 14:05:52 +00:00
parent 6cdf720037
commit 9b7b65b014
2 changed files with 17 additions and 4 deletions

View File

@ -293,7 +293,6 @@ get_FAT:
get_free_FAT: get_free_FAT:
;----------------------------------------------------------- ;-----------------------------------------------------------
; input : EAX = # cluster for start the searching
; output : if CARRY=0 EAX = # first cluster found free ; output : if CARRY=0 EAX = # first cluster found free
; if CARRY=1 disk full ; if CARRY=1 disk full
; Note : for more speed need to use fat_cache directly ; Note : for more speed need to use fat_cache directly
@ -301,10 +300,14 @@ get_free_FAT:
push ecx push ecx
mov ecx,[LAST_CLUSTER] ; counter for full disk mov ecx,[LAST_CLUSTER] ; counter for full disk
sub ecx,2 sub ecx,2
mov eax,[fatStartScan]
cmp eax,2
jb gff_reset
gff_test: gff_test:
cmp eax,[LAST_CLUSTER] ; if above last cluster start at cluster 2 cmp eax,[LAST_CLUSTER] ; if above last cluster start at cluster 2
jbe gff_in_range jbe gff_in_range
gff_reset:
mov eax,2 mov eax,2
gff_in_range: gff_in_range:
@ -328,6 +331,8 @@ get_free_FAT:
ret ret
gff_found: gff_found:
lea ecx,[eax+1]
mov [fatStartScan],ecx
pop ecx pop ecx
clc clc
ret ret
@ -671,6 +676,8 @@ add_disk_free_space:
jne add_not_fs jne add_not_fs
add [ebx+0x1e8],ecx add [ebx+0x1e8],ecx
mov eax,[fatStartScan]
mov [ebx+0x1ec],eax
call hd_write call hd_write
; cmp [hd_error],0 ; cmp [hd_error],0
; jne add_not_fs ; jne add_not_fs
@ -1478,7 +1485,6 @@ fat_notroot_next_write:
jmp fat_notroot_next_sector jmp fat_notroot_next_sector
fat_notroot_extend_dir: fat_notroot_extend_dir:
push eax push eax
mov eax, [eax]
call get_free_FAT call get_free_FAT
jnc .found jnc .found
pop eax pop eax
@ -1941,7 +1947,6 @@ fs_HdRewrite:
mov esi, edx mov esi, edx
test ecx, ecx test ecx, ecx
jz .done jz .done
mov eax, 2
call get_free_FAT call get_free_FAT
jc .diskfull jc .diskfull
push eax push eax
@ -2392,7 +2397,6 @@ hd_extend_file:
jae .extend_done jae .extend_done
; add new cluster ; add new cluster
push eax push eax
mov eax, edx
call get_free_FAT call get_free_FAT
jc .disk_full jc .disk_full
mov edx, [fatEND] mov edx, [fatEND]

View File

@ -49,6 +49,8 @@ fatBAD dd 0x0FFFFFF7
fatEND dd 0x0FFFFFF8 fatEND dd 0x0FFFFFF8
fatMASK dd 0x0FFFFFFF fatMASK dd 0x0FFFFFFF
fatStartScan dd 2
fs_dependent_data_end: fs_dependent_data_end:
file_system_data_size = $ - PARTITION_START file_system_data_size = $ - PARTITION_START
if file_system_data_size > 96 if file_system_data_size > 96
@ -423,6 +425,7 @@ boot_read_ok:
inc eax inc eax
mov [LAST_CLUSTER],eax mov [LAST_CLUSTER],eax
dec eax ; cluster count dec eax ; cluster count
mov [fatStartScan],2
; limits by Microsoft Hardware White Paper v1.03 ; limits by Microsoft Hardware White Paper v1.03
cmp eax,4085 ; 0xff5 cmp eax,4085 ; 0xff5
@ -436,6 +439,12 @@ fat32_partition:
movzx eax,word [ebx+0x30] ; fs info sector movzx eax,word [ebx+0x30] ; fs info sector
add eax,[PARTITION_START] add eax,[PARTITION_START]
mov [ADR_FSINFO],eax mov [ADR_FSINFO],eax
call hd_read
mov eax,[ebx+0x1ec]
cmp eax,-1
jz @f
mov [fatStartScan],eax
@@:
popad popad