Commit Graph

728 Commits

Author SHA1 Message Date
pooka 4b8065ff1e mntflushbuf() cargo cult comment mania cleanup. there is no mntflushbuf(). 2007-07-09 00:01:42 +00:00
rumble 0bbb4e920d Clamp down tigher on the bound around 'numextents'. Add a few comments
to make it clearer what we're tracking.
2007-07-04 20:20:30 +00:00
rumble 0aef936cbe Additional fixes/enhancements:
1) Comply with the way buffercache(9) is intended to be used. Now we
       read in single blocks of EFS_BB_SIZE, never taking in variable
       length extents with a single bread() call.

    2) Handle symlinks with more than one extent. There's no reason for
       this to ever happen, but it's handled now.

    3) Finally, add a hint to our iteration initialiser so we can start
       from the desired offset, rather than naively looping through from
       the beginning each time. Since we can binary search the correct
       location quickly, this improves large sequential reads by about
       40% with 128MB files. Improvement should increase with file size.
2007-07-04 19:24:09 +00:00
rumble 1798f1d8df Fix a significant performance bug in efs_read:
When reading a file, we would erroneously iterate to the next extent
before having filled the entire uio request. This lead to unnecessary
extent iteration and excessive calls to efs_read.

Sequential read performance has doubled in the uncached case and
quadrupled when data is buffered.
2007-07-04 18:40:18 +00:00
pooka 84684ff767 check for invalid vtype 2007-07-02 21:14:00 +00:00
pooka ea1108ce11 support turning REQUIREDIR off and extra consume in lookup 2007-07-02 18:25:36 +00:00
pooka df6f052d2f Get rid of the "int *refs" parameter to inactive: the same can be
accomplished now with puffs_setbacks.
2007-07-02 10:24:17 +00:00
pooka 25285a0f9c loosen KASSERT: we can also fail due to ENOMEM 2007-07-01 23:30:42 +00:00
pooka d410664985 Give the file server to ability to request the entire pathname buffer
under lookup by using PUFFS_KFLAG_LOOKUP_FULLPNBUF instead just the
current component.
2007-07-01 22:54:16 +00:00
pooka ffe0a01441 Instead of supplying a plain pid, supply an abstract struct puffs_cid *,
which can currently be used to query the pid and lwpid.
2007-07-01 17:22:13 +00:00
pooka 438f52d212 make puffs_cred an opaque type 2007-07-01 15:30:15 +00:00
rumble 1b3d6b0053 Remove a superfluous pasted structure definition, permitting ALL to
build again.

Caught by Hisashi T Fujinaka.
2007-07-01 01:09:05 +00:00
pooka 6b0a9db09f Fix logic flaw in KASSERT. Seems like my lkm wasn't compiled with
DIAGNOSTIC ...
2007-06-30 16:28:14 +00:00
rumble 6bb85b28da Additional documentation on extents and some artificial limitations SGI
has introduced (and changed in backwards-incompatible ways) over the years.
2007-06-30 15:56:16 +00:00
pooka 835b0326c5 Using POOL_INIT here makes no sense, since file systems always have
an init method.  So get rid of it and #ifdef _LKM and just always
init in the init method.  Give malloc types the same treatment.
Makes file systems nicer to work with in linksetless environments
and fixes a few LKM discrepancies.
2007-06-30 09:37:53 +00:00
rumble 6912898dc8 Add read-only support for SGI's Extent File System.
Reviewed by pooka@.
2007-06-29 23:30:16 +00:00
tsutsui 4a838a2458 Fix mnt_dev_bshift value. Pointed out by rumble@.
I'm not sure how mnt_dev_bshift is used and
whether BFS_BSHIFT is correct for it, but as rumble
said shifting BFS_BSIZE (==512) seems completly wrong.
2007-06-28 12:33:18 +00:00
pooka f055736150 Simplify code, mainly vop_strategy. No functional change 2007-06-26 12:50:49 +00:00
pooka 53a4105885 Actually, keep PUFFS_KFLAG_NOCACHE and -o cache around as shorthand
to neither page- nor namecache.
2007-06-24 22:25:49 +00:00
pooka df01a64b7a Split the NOCACHE option in twain: NOCACHE_NAME & NOCACHE_PAGE. 2007-06-24 22:16:03 +00:00
pooka e601546393 Refactor the pnode2vnode translation slightly so that VFS_ROOT
can use it directly.
2007-06-21 14:54:49 +00:00
pooka 41df8e0fed Reorganize how the root vnode is fetched so that it doesn't always
go through VFS_ROOT() and allow to fetch it without locking it.
This allows us to call the cache flush operations also for the root
vnode and most notably fixes e.g. a "No such file or directory"
for a psshfs root directory ls -l when a file was locally deleted
and remotely re-created.

Also fix some sloppy programming in root node fetch (mostly cosmetic).
2007-06-21 14:11:34 +00:00
pooka f8326bf98e Move puffs to a two clause license where it already isn't so. And
as agc pointed out, even files with the third clause were already
effectively two clause because of a slight bug in the language...
2007-06-06 01:54:59 +00:00
pooka e2819ad1be In very verbose debug mode, print also return values for operations
(well, at least for those that go through checkop()).
2007-06-06 01:33:10 +00:00
yamt da51d139a4 improve post-ubc file overwrite performance in common cases.
ie. when it's safe, actually overwrite blocks rather than doing
read-modify-write.

also fixes PR/33152 and PR/36303.
2007-06-05 12:31:30 +00:00
yamt 7e6f80a234 \xa0 -> space. 2007-06-01 15:59:37 +00:00
pooka 68568e7a22 forgot to commit this with puffs_vnops.c 1.72:
Actually, we do need separate "no references in file server" and
"noref + inactive" flags if we wish to correctly support unix open
file semantics and optimize away pre-reclaim cache flushes.  So,
add PNODE_DYING which stands for norefs + inactive.
2007-05-19 16:50:49 +00:00
pooka 121b6fb7b3 Actually, we do need separate "no references in file server" and
"noref + inactive" flags if we wish to correctly support unix open
file semantics and optimize away pre-reclaim cache flushes.  So,
add PNODE_DYING which stands for norefs + inactive.
2007-05-19 16:35:01 +00:00
pooka e99cb62bcc Introduce noref setbacks, which the file server can use to signal
the kernel it has 0 references to the node in question.  In other
words, this can be used to avoid inactive(), or, if the file server
does not implement inactive, prompt reclaim for removed nodes.
2007-05-18 15:46:09 +00:00
pooka 93dd832918 selrecord() before calling userspace to avoid (very theoretical) race
where selinfo contains uninitialized garbage
2007-05-18 14:25:30 +00:00
pooka 9d9f624f97 Support VOP_POLL. This requires some acrobatics on the puffs_node,
as we give a reference to userspace for the puffs_node for the
duration of the poll call.  So reference count puffs_node separately
from the parent vnode.  vref()/vrele() is not possible due to a possible
surprise visit from VOP_INACTIVE.
2007-05-18 13:53:08 +00:00
pooka 339652951e Make it possible for the file server to specify the root vnode type
and other information instead of always using VDIR.  To make this
possible without races, require all root node information already
in puffs_mount() and nuke puffs_start2() and the associated start
operation completely.

requested/inspired by Tobias Nygren
2007-05-17 13:59:22 +00:00
pooka d79dbd3583 In case strategy memory allocation for B_ASYNC|B_READ fails,
make sure to release the buf.
2007-05-15 12:48:48 +00:00
pooka a6b1636499 Adventures in file systems, part (u_quad_t)-1: we can't use the
file system value for the size of device special files, as that
comes from specfs instead of the "host" file system.  Therefore,
take care that getattr doesn't override the value of vp->v_size.
2007-05-08 21:39:03 +00:00
pooka 4537434d57 If the op was interrupted, decrease ops waiting for fetch from the
file server only if the op was still waiting for fetch (as opposed
to waiting for the response).  Also, properly flag the possible
following inactive as an op for which we do not want to wait for
the response from the file server.
2007-05-08 21:16:55 +00:00
pooka 151ee075e9 Introduce puffs "setbacks", which can be used to set certain flags
for nodes upon return from the userspace.  Currently it can be used
to indicate that the file server should be notified of "inactive"
in case the file server has opted to not receive inactive every
time the reference count for a vnode drops to zero.  (inactive is
a common event, almost never requires any action and must be executed
sychronously, so it is wasteful).

While doing this, cleanup the release-relock nonsense from the
vntouser*() arguments.  It was never enabled and the whole LOCKEDVP()
concept was very broken to begin with.
2007-05-07 17:14:54 +00:00
pooka b5aae3d4e3 If setattr is called explicitly, use that as the sign to flush out
all metadata info cached in the kernel while we're setattr'ing in
any case.  Solves problems such as truncate (via extend-by-write)
+ chmod resulting in EPERM because the file was already read-only
when the actual truncate was flushed out of the kernel in fsync.
2007-05-06 19:43:14 +00:00
pooka 6ffefad6ef Fix a problem introduced when I converted puffs to use newlock2:
when unmounting the file system in case of a certain timing (and
possibly some other conditions), a thread would wait on a condition
variable, while another thread broadcast the cv and immediately
proceeded to destroy it.  The result was a system frozen completely
solid shorly after the process waiting for the cv woke up.  So
introduce reference counting to synchronize destruction of the
resources in unmount.

I was able to repeat the problem only on my laptop in some special
cases, so I do not know how common it was.  Ironically, killing
the file server process violently instead of unmount() didn't have
this problem because it never entered the unmount path from two
directions.
2007-05-01 12:18:40 +00:00
msaitoh 8ce1f4fff2 fix typos 2007-04-29 20:23:34 +00:00
pooka b474c785b7 If ubc style write fails, do not extend the file by zero-padding
it.  It might be that the file server is either crashing or just
returning consistent errors.  uiomove() would handle the error,
but if the pages weren't faulted in, memset() to the unfaultable
ubc window would cause a kernel page fault.
2007-04-24 16:29:29 +00:00
pooka c25fa1208b remember to flag park as done when we're done with it 2007-04-24 09:44:57 +00:00
pooka 8689b1a6b2 Now that puffs_park is allocated from the heap and actually freed
by the userdead routine, don't do a TAILQ_FOREACH but rather an
honest for loop.
2007-04-22 21:52:37 +00:00
pooka 6770f9f87e Issue close to the file server asynchronously. We're not interested
in the return value.
2007-04-22 18:50:28 +00:00
pooka bc38632c58 define PUFFS_KFLAG_WTCACHE, which makes the page cache write-through 2007-04-22 18:02:05 +00:00
pooka e4526ed3a0 Take care not to access park->park_preq if the waiter is gone, as
that memory is no longer available.
2007-04-21 10:36:59 +00:00
pooka 1de42023d1 don't mutex_enter() manually, we've already park_reference()d a few
lines earlier for entering the same mutex
2007-04-20 21:35:31 +00:00
pooka ac5f1b1b78 * in readdir, don't copy extra memory back and forth to userspace
* consistent usage of the variable argsize with the rest of the module
2007-04-20 11:56:35 +00:00
pooka 07ba7a7d5f Size of a readdir cookie is sizeof(**ap->a_cookies), not
sizeof(*ap->a_cookies).  Fixes nfs readdir in the case that a
directory had lots of entries with short names.
2007-04-20 11:36:25 +00:00
yamt 337d052ee1 hold proclist_mutex when calling psignal(). 2007-04-19 11:05:14 +00:00
pooka 5880c46d2d fix comment in previous 2007-04-16 14:09:53 +00:00
pooka 947c4b9f60 Allow to set non-blocking mode for transport fd even if the file
system is not yet mounted.
2007-04-16 14:09:00 +00:00
pooka f2cea5c791 Sanity-check & possibly adjust number of hash buckets already before
returning the mount argument structure to userspace.
2007-04-16 13:54:07 +00:00
pooka 96fd5059d7 catch invalid size file handles already in the kernel 2007-04-16 13:24:35 +00:00
pooka 4ccbce8168 Give the file server the ability to specify the file handle length
instead of defining a static length file handle on the framework-level.
2007-04-16 13:03:26 +00:00
chs aba740b225 define a pager flag PGO_RECLAIM, similar to FSYNC_RECLAIM, and use it
to skip unnecessary flushing when layered file system vnodes are recycled.
this also prevents a deadlock with the dodgy LFS putpages routine.
fixes the non-LFS part of PR 36150.
2007-04-16 05:14:54 +00:00
xtraeme 8d9be19250 size_t is unsigned, so use zu rather than zd which is for ssize_t,
as Matt Thomas pointed out.
2007-04-14 16:52:22 +00:00
xtraeme 6465fceffd Use zd to printf size_t. 2007-04-14 16:13:18 +00:00
pooka 0c3748498f Allow file servers to request the number of hash cookie buckets for
pnode -> vnode reverse lookup.
2007-04-13 15:25:35 +00:00
pooka 4e4ce72bb3 * add fhlen to kernel argument structure
* rename it to puffs_kargs instead of puffs_args
2007-04-13 13:31:11 +00:00
reinoud 1adc8479ba Some rogue implementations use random physical partion numbers just to
break other implementations so lookup the physical number instead of
indexing it. Choosing random numbers here is legal according to the specs,
but not a logical choice and most likely done as a wierd kind of copy
protection.

Rogue implementation found to use this
	*Microsoft CDIMAGE UDF
2007-04-12 01:56:36 +00:00
pooka f50d2a26f2 * support VFS_FHTOVP and VFS_VPTOFH
* support cookies in for VOP_READDIR

nfs exporting puffs file systems works now
2007-04-11 21:03:05 +00:00
pooka c634885e0f make overspammy debug printf less overspammy 2007-04-11 09:43:19 +00:00
pooka bc8224a1b3 fix comment: struct fid is in fstypes.h now 2007-04-09 12:21:24 +00:00
hannken fc6776f366 Remove now obsolete vn_start_write() and vn_finished_write() and
corresponding flags.

Revert softdep_trackbufs() to its state before vn_start_write() was added.

Remove from struct mount now unneeded flags IMNT_SUSPEND* and
members mnt_writeopcountupper, mnt_writeopcountlower and mnt_leaf.

Welcome to 4.99.17
2007-04-08 11:20:42 +00:00
hannken e956461048 Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-07 15:06:53 +00:00
pooka 43c6ec1a06 support flushing pagecache 2007-04-06 17:48:44 +00:00
pooka 13fa815486 actually, we don't need a separate op for flushing the whole page cache
of a node, just use the range op with endoff = 0
2007-04-06 17:05:34 +00:00
pooka bd8d0a2ae0 * enable PUFFS_INVAL_PAGECACHE_NODE_RANGE
* add input parameter validation
2007-04-06 16:37:02 +00:00
pooka 3651f3e73b Fix one more bug from today's commit: don't remove the op for which
getops runs out of file server buffer space from the request queue.
Otherwise that operation silently vanishes and things go, well, quite
wrong.
2007-04-04 21:02:30 +00:00
pooka a0d5166093 fix two loop mutex botches in previous 2007-04-04 20:22:47 +00:00
pooka fa71b0706d Make it possible to interrupt waiters for fs operation completion
again.  This is useful until locking is further developed and basically
any deadlocks can be solved by killing appropriate processes.

Thanks especially to Tommi Kyntola and Antti Louko for sitting down
with me and discussing resource ownership and locking strategies
in implementing this.
2007-04-04 16:13:51 +00:00
pooka ad018126a3 s/ppark/park/ to make all the variable names consistent - park is
always a pointer now.  no functional change
2007-04-04 15:50:56 +00:00
rmind 523c1fc3e1 filecore_mountfs: Remove the dead code - fcmp cannot be non-zero here.
CID: 714
2007-04-04 02:00:58 +00:00
pooka 9cc76110cd In sync, skip vnodes which have a null v_data pointer. This is a
workaround for the problem analyzed more deeply in kern/30831.  In
short, the problem is keeping the vnode on the mount point vnode
list during reclaim.  If reclaim happens to sleep (as is a possibility
with smbfs due to calling vrele() and therefore possibly VOP_INACTIVE),
code going through the entire mountpoint vnode list will hit
half-reclaimed vnodes.
2007-04-03 14:18:19 +00:00
pooka de976b706d g/c some commented ltsleep calls accidentally left from newlock2 adaptation 2007-03-30 18:25:02 +00:00
pooka 115fa924ee * abstract ASYNCBIOREAD and let callers freely issue a callback called
from putop.  even though there's only one user currently, makes code
  more readable
* move "delta" to a standard parameter in vntouser and get rid of the
  specialcase vntouser_delta
2007-03-30 17:48:57 +00:00
pooka 78762a532d in userdead assign waiter return value only if there is a waiter for
a particular request
2007-03-29 22:11:43 +00:00
pooka 6ce49d93c1 convert to MALLOC_JUSTDEFINE 2007-03-29 16:30:07 +00:00
pooka 78693816f2 Convert spinlocks & sleep/wakeup to newlock2 locking stuff. Fix a
bunch of bugs.

* park structures are now always allocated from a pool instead of a
  mixed stack/malloc allocation
* get rid of the whole adjbuf concept, always just alloc the maximal
  amount of memory to satisfy a request
* little regression: don't allow interrupting wait from file system
  to userspace; this had problems already before, but now the problems
  really started to shine through.  I'll try to make this work again
  some day.
* fix bmap to return a sensible value in runp
2007-03-29 16:04:26 +00:00
dillo 41627b2c38 Add support for HFS Wrapper (HFS+ volume inside an HFS volume).
Remove offset argument, we should now find an HFS+ volume in any
of its standard places.

Based on work from and test image provided by Pelle Johansson.
2007-03-22 13:21:28 +00:00
dillo 30f474b9e1 Add support for HFS Wrapper (HFS+ volume inside an HFS volume).
Remove offset argument, we should now find an HFS+ volume in any
of its standard places.
2007-03-22 13:21:27 +00:00
dillo 081267c306 Add a few. 2007-03-22 13:20:13 +00:00
pooka 2bddbed0e0 export puffs version of namei ISLASTCN macro to userspace 2007-03-20 18:28:49 +00:00
tsutsui c55df5782d Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-20 11:27:48 +00:00
pooka 8d9c021816 * rework the page cache interaction a bit: cache metadata in the
kernel and flush it out all at once instead of continuous updating
* add support for delivering notifications to the file server about
  when a page was written to (but disabled by default for now).  the
  file server can use this to request flushing or invalidating the
  kernel page cache
2007-03-20 10:21:58 +00:00
dillo 0fb2977031 args.path is in UIO_USERSPACE too.
Fixes statvfs on macppc and PR kern/36012.
Thanks to Magnus Henoch for testing.
2007-03-19 09:16:22 +00:00
pooka 040eb2fb48 Support B_READ|B_ASYNC in strategy by calling biodone() directly
when the file server puts the result.
2007-03-14 12:13:58 +00:00
ad 297c1212be Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-13 14:16:07 +00:00
ad 4b1d78c00e Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-13 02:11:28 +00:00
ad 86ed875648 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-13 01:34:21 +00:00
ad 59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
dillo e100c48afd Fix PR kern/35953 by mange at freemail dot hu (panic on mount):
(hfslib_open_volume) We are only interested in the catalgo and
extents header, so read the first 512 bytes, not the whole first
extent.  Also makes mounting a lot faster.
2007-03-09 22:14:09 +00:00
dillo d0c955805c Remove hfsp directories, they have been reimported as hfs. 2007-03-06 11:31:21 +00:00
dillo 56c3e41252 Complete rename of hfsp to hfs, requested by thorpej. 2007-03-06 11:28:44 +00:00
dillo 25e99827c3 Rename files from hfsp to hfs. 2007-03-06 00:22:04 +00:00
dillo d3fee42230 Temporarily readd, until rename is complete -- renaming the directory
is not enough.

(I need sleep, will clean this up tomorrow.  Sorry for the mess.)
2007-03-06 00:15:50 +00:00
dillo 601515c0d6 Renamed to HFS. 2007-03-06 00:11:38 +00:00
dillo 4f1d6e612e nitial import of (experimental read-only) implementation of Apple
HFS+ file system.

Originally developed for Google Summer of Code 2005 by Yevgeny Binder,
updated and enhanced by me.
2007-03-06 00:10:34 +00:00
dillo 9274a5c0f1 Integrate apmlabel and HFS+ file system. 2007-03-05 23:18:01 +00:00
dillo 9cf283f2a5 Initial import of (experimental read-only) implementation of Apple
HFS+ file system.

Originally developed for Google Summer of Code 2005 by Yevgeny Binder,
updated and enhanced by me.
2007-03-05 23:01:06 +00:00