Re: [RFC PATCH 19/19] tarfs: introduce tar fs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 18, 2023 at 09:25:18AM -0300, Wedson Almeida Filho wrote:
> +    fn read_folio(inode: &INode<Self>, mut folio: LockedFolio<'_>) -> Result {
> +        let pos = u64::try_from(folio.pos()).unwrap_or(u64::MAX);
> +        let size = u64::try_from(inode.size())?;
> +        let sb = inode.super_block();
> +
> +        let copied = if pos >= size {
> +            0
> +        } else {
> +            let offset = inode.data().offset.checked_add(pos).ok_or(ERANGE)?;
> +            let len = core::cmp::min(size - pos, folio.size().try_into()?);
> +            let mut foffset = 0;
> +
> +            if offset.checked_add(len).ok_or(ERANGE)? > sb.data().data_size {
> +                return Err(EIO);
> +            }
> +
> +            for v in sb.read(offset, len)? {
> +                let v = v?;
> +                folio.write(foffset, v.data())?;
> +                foffset += v.data().len();
> +            }
> +            foffset
> +        };
> +
> +        folio.zero_out(copied, folio.size() - copied)?;
> +        folio.mark_uptodate();
> +        folio.flush_dcache();
> +
> +        Ok(())
> +    }

Who unlocks the folio here?




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux