tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: [PATCH] GOP_ALLOC and fallocate for PUFFS
On 02 Oct 2014, at 06:45, Emmanuel Dreyfus <manu%netbsd.org@localhost> wrote:
> J. Hannken-Illjes <hannken%eis.cs.tu-bs.de@localhost> wrote:
>
>> genfs_gop_write calls genfs_do_io which does "error = biowait(mbp);"
>> near the end. This will catch errors from VOP_STRATEGY.
>
> I run the code below but VOP_PUTPAGES never return anything else than 0.
Sure -- why should it?
GOP_ALLOC() gets called from VOP_GETPAGES() for missing pages. Here you
run VOP_PUTPAGES() on a range known to be unmapped so it becomes a NOP.
GOP_ALLOC() aka puffs_gop_alloc() has to run on the client to make
sure the pages in question are allocated and may be faulted in.
The client has to fill holes or extend files.
> int
> puffs_gop_alloc(struct vnode *vp, off_t off, off_t len,
> int flags, kauth_cred_t cred)
> {
> struct puffs_mount *pmp = MPTOPUFFSMP(vp->v_mount);
> off_t start, end;
> int pgo_flags = PGO_CLEANIT|PGO_SYNCIO|PGO_PASTEOF;
> int u_flags = PUFFS_UPDATESIZE|PUFFS_UPDATEMTIME|PUFFS_UPDATECTIME;
> int error;
>
> if (EXISTSOP(pmp, FALLOCATE)) {
> error = _puffs_vnop_fallocate(vp, off, len);
> goto out;
> }
>
> start = trunc_page(off);
> end = round_page(off + len);
>
> if (off + len > vp->v_size)
> uvm_vnp_setwritesize(vp, off + len);
>
> mutex_enter(vp->v_interlock);
> error = VOP_PUTPAGES(vp, start, end, pgo_flags);
>
> if (off + len > vp->v_size) {
> if (error == 0) {
> uvm_vnp_setsize(vp, off + len);
> puffs_updatenode(VPTOPP(vp), u_flags, vp->v_size);
> } else {
> uvm_vnp_setwritesize(vp, vp->v_size);
> }
> }
> out:
> return error;
> }
--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig (Germany)
Home |
Main Index |
Thread Index |
Old Index