[SLOF] [PATCH 1/4] deblocker: Add a 'write' function

Alexey Kardashevskiy aik at ozlabs.ru
Thu Dec 1 13:29:15 AEDT 2016


On 16/11/16 00:02, Thomas Huth wrote:
> To support block writes, the deblocker should feature a 'write'
> function, too. Since our only client that tries to use write
> accesses so far (GRUB2) is always writing whole sectors, we
> do not do the complicated read-modify-write dance here yet, but
> simply check that the client always tries to write whole sectors.
> 
> Reviewed-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
> Signed-off-by: Thomas Huth <thuth at redhat.com>

Thanks, applied all 4 patches.


> ---
>  slof/fs/packages/deblocker.fs | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/slof/fs/packages/deblocker.fs b/slof/fs/packages/deblocker.fs
> index 83cd712..ebed5cf 100644
> --- a/slof/fs/packages/deblocker.fs
> +++ b/slof/fs/packages/deblocker.fs
> @@ -68,3 +68,24 @@ INSTANCE VARIABLE fail-count
>    my-block @ adr @ len @ move THEN
>  
>    r> ;
> +
> +: write-blocks ( addr block# #blocks -- #writtenblks )
> +    s" write-blocks" $call-parent
> +;
> +
> +: write ( addr len -- actual )
> +    dup block-size @ mod IF
> +        ." ERROR: Can not write partial sector length." cr
> +        2drop 0 EXIT
> +    THEN
> +    block-size @ /                             ( addr #blocks )
> +    offset @                                   ( addr #blocks offset )
> +    dup block-size @ mod IF
> +        ." ERROR: Can not write at partial sector offset." cr
> +        3drop 0 EXIT
> +    THEN
> +    block-size @ / swap                        ( addr block# #blocks )
> +    write-blocks                               ( #writtenblks )
> +    block-size @ *
> +    dup offset +!
> +;
> 


-- 
Alexey


More information about the SLOF mailing list