[pso] Fw: [Tema] Actualizare dmap
Oprescu Bogdan
bcoprescu at yahoo.com
Fri May 6 12:32:29 EEST 2011
From: Vlad Dogaru <ddvlad at rosedu.org>
To: Oprescu Bogdan <bcoprescu at yahoo.com>; Proiectarea Sistemelor de Operare <pso at cursuri.cs.pub.ro>
Sent: Friday, May 6, 2011 10:56 AM
Subject: Re: [pso] [Tema] Actualizare dmap
On Wed, May 04, 2011 at 09:54:55AM -0700, Oprescu Bogdan wrote:
> Am urmatoarea problema:
> - fac alocarea blocurilor in functia get_block. Get block e apelata la scrire si la
> citire in writepage si readpage. Tot aici fac si actualizarea dmap.
> - atunci cand scriu intr-un fisier, functia de scriere este apelata mai tarziu de sistem,
> astfel incat dmap se actualizeaza dupa cam 30 de secunde sau cand dau cat pe fisier.
Ce funcție folosești pentru a scrie/citi în fișier? do_sync_read nu ar
trebui să se comporte cum descrii tu.
Vlad
Am asa:
struct file_operations pitix_file_operations = {
.read
= do_sync_read,
.aio_read = generic_file_aio_read,
.write = do_sync_write,
.aio_write = generic_file_aio_write,
.mmap = generic_file_mmap,
.fsync
= generic_file_fsync,
.splice_read = generic_file_splice_read,
.splice_write = generic_file_splice_write,
.llseek = generic_file_llseek,
};
writepage, readpage, bmap, write_begin sunt implementata ca in minix.
Comportamentul la scriete este urmatorul:
root at spook:/tmp/pitix.mnt# echo abc > a
root at spook:/tmp/pitix.mnt# ls -l
total 4
-rw-r--r-- 2 root root 4 2011-05-06 12:11 a
drwxrwxrwx 1 root root 512 2011-05-06 12:11 lots_of_files
root at spook:/tmp/pitix.mnt# dmesg
| grep 'pitix writepage'
root at spook:/tmp/pitix.mnt# cat a
abc
root at spook:/tmp/pitix.mnt# dmesg | grep 'pitix writepage'
root at spook:/tmp/pitix.mnt# dmesg | grep 'pitix writepage'
root at spook:/tmp/pitix.mnt# dmesg | grep 'pitix writepage'
[58861.469694] pitix writepage
[58861.471796] pitix writepage
root at spook:/tmp/pitix.mnt#
dupa cum se vede writepage se apeleaza tarziu, iar daca se face unmount intre timp datele nu se mai scriu pe disc.
Multumesc,
Bogdan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cursuri.cs.pub.ro/pipermail/pso/attachments/20110506/e8a58cdb/attachment.htm>
More information about the pso
mailing list