Age | Commit message (Collapse) | Author |
|
Previously, libdiskfs would deadlock on contention on renamedirlock
due to the lock being taken spuriously.
Found using fsstress from the Linux Test Project.
* libdiskfs/dir-rename.c (diskfs_S_dir_rename): Remove spurious
pthread_mutex_lock.
|
|
Expose ST_NOATIME as flag (if available in glibc) if diskfs is set in noatime
mode.
* libdiskfs/file-statfs.c (diskfs_S_file_statfs): Set ST_NOATIME if
_DISKFS_NOATIME is set.
|
|
Only root is allowed to change the high 16 bits. The TODO entry says
otherwise, but that must be a mistake. For reference, see the glibc
sources, sysdeps/mach/hurd/bits/stat.h.
* libdiskfs/file-chflags.c (diskfs_S_file_chflags): Add permission
check.
* TODO (libdiskfs): Remove entry.
|
|
If the size argument is 0, realloc may either return NULL, or return a
pointer that is only valid for use with free(3). In either case, the
memory is freed. So if realloc would return NULL (it does not on
GNU), the current code would double free p.
Found using the Clang Static Analyzer.
* libports/bucket-iterate.c (_ports_bucket_class_iterate): Avoid
calling realloc if no ports were matched.
|
|
Found using the Clang Static Analyzer.
* trans/fakeroot.c (new_node): Do not leak a pointer to freed memory.
Store NULL at *np instead. This fixes a node use-after-free in
netfs_S_dir_lookup.
|
|
Found using the Clang Static Analyzer.
* libshouldbeinlibc/timefmt.c (fmt_named_interval): Fix dead
initialization.
|
|
Found using the Clang Static Analyzer.
* ftpfs/dir.c (refresh_dir): Fix error handling.
|
|
* Makeconf (mach_debug_defs_names,mach_debug_defs): New variables.
* Makeconf: Add rule to generate local $(mach_debug_defs) files.
* procfs/Makefile: Remove vpath for mach_debug defs.
|
|
* Makefile (prog-subdirs): Add procfs.
|
|
|
|
Move the procfs translator to its own subdirectory 'procfs'.
This is the last commit to this repository. Development of the procfs
translator will continue in the main Hurd repository.
* procfs/Makefile: Replace the standalone Makefile with the one from
the Debian packaging repository.
|
|
|
|
Start the translator specified by the NODE's passive translator record
and set it as NODE's active translator. This is the equivalent of
doing:
% settrans --active /node $(showtrans /node)
* utils/settrans.c (argp_option): Add --start.
(parse_opt): Handle --start.
(main): Retrieve the passive translator record if --start is given.
|
|
* hurd/hurd_types.h (ctty_t): New type definition.
* hurd/term.defs (ctty_t): New type definition.
* term/mig-decls.h: New file.
* term/mig-mutate.h: Add mutators, includes.
* term/term.h: Add include guards.
* term/users.c (S_termctty_open_terminal): Fix receiver lookup.
* boot/boot.c (S_termctty_open_terminal): Likewise.
|
|
Handle multiple request types as recommended by the Mach Server
Writer's Guide section 4, subsection "Handling Multiple Request
Types". This avoids initializing the reply message in every X_server
function.
* term/main.c (demuxer): Improve the demuxer function.
|
|
* Makefile (prog-subdirs): Add random.
|
|
|
|
Move the random translator to its own subdirectory 'random'.
This is the last commit to this repository. Development of the random
translator will continue in the main Hurd repository.
|
|
* ext2fs/dir.c (diskfs_lookup_hard): Use ino_t for retry_dotdot.
|
|
* ext2fs/dir.c (diskfs_lookup_hard): Use vm_address_t for blockaddr.
|
|
* extfs/dir.c: Use size_t where appropriate.
|
|
* ext2fs/pager.c (disk_cache_block_ref): block cannot be negative.
|
|
* libdiskfs/boot-start.c (diskfs_boot_start): Avoid implicit integer
conversion.
|
|
* libdiskfs/diskfs.h (struct peropen): Use off_t for filepointer.
|
|
* hurd/shared.h (struct shared_io): Use blksize_t for optimal_transfer_size.
|
|
* include/refcount.h (refcounts_promote): Use ~0U.
(refcounts_demote): Likewise.
|
|
* libnetfs/trans-callback.c (_netfs_translator_callback2_fn): Free
user if creating the protid failed.
|
|
There is no need to keep all the threads around, just the master
thread.
* tmpfs/tmpfs (diskfs_thread_function): Use a thread timeout.
|
|
into random
|
|
* random.c (trivfs_S_io_read): Catch buffer allocation error, and
truncate allocation when we return less data than requested.
|
|
GNU libc has had them for a long time.
* configure.ac: Remove checks for 'getgrouplist' and 'uselocale'.
* libshouldbeinlibc/idvec-impgids.c (_merge_implied_gids): Remove #ifdef
HAVE_GETGROUPLIST and remove #else arm.
* libthreads/cthreads.c: Remove #ifdef HAVE_USELOCALE, keeping its
bodies.
|
|
|
|
Until the Hurd specific header is available, provide a local
declaration of ped_device_new_from_store.
* libstore/part.c (ped_device_new_from_store): New declaration.
|
|
|
|
* configure.ac: Call AC_NO_EXECUTABLES when cross-compiling.
|
|
Previously, name cache lookup operation completed in O(n) time. This
means that making the cache too large would decrease the performance.
Therefore it was required to tune the size.
Implement the name cache using a hash table.
We use buckets of a fixed size. We approximate the least-frequently
used cache algorithm by counting the number of lookups using
saturating arithmetic in the two lowest bits of the pointer to the
name. Using this strategy we achieve a constant worst-case lookup and
insertion time.
Since we are not bound by the size of the cache anymore, increase its
size from 200 to 1024.
* libdiskfs/name-cache.c: Implement the name cache using a hash table.
(diskfs_enter_lookup_cache): Change accordingly.
(diskfs_purge_lookup_cache): Likewise.
(diskfs_check_lookup_cache): Likewise. Also, hard code a
cache miss for the parent of the root directory and merge unlocking
and releasing of node references.
|
|
The current name cache lookup operation completes in O(n) time. This
means that making the cache too large would decrease the performance.
Therefore it was required to tune the size, hence the need for
statistics.
We will use a data structure with worst case constant lookup times in
the future, removing the need to fine tune the cache size.
* libdiskfs/name-cache.c: Remove the statistics code from the name
cache.
|
|
When using fat nodes, expressions of the form E->nn can be rewritten
as netfs_node_netnode (E). This is much faster as it only involves a
offset calculation. For reference, I used the following semantic
patch to create the patch:
@@
expression E;
@@
- E->nn
+ netfs_node_netnode (E)
* trans/fakeroot.c: Use netfs_node_netnode instead of np->nn.
|
|
Previously, fakeroot stored netnodes in the hash table. But we are
not interested in a cache for netnodes, we need a node cache. So
fakeroot kept pointers to the associated node object in each netnode
object.
Use fat netfs nodes, which combine node and netnode objects.
* trans/fakeroot.c (struct netnode): Remove np.
(idport_ihash): Fix ihash location pointer offset.
(new_node): Allocate fat nodes, store the node pointer in the hash
table.
(netfs_node_norefs): Adjust accordingly.
(netfs_S_dir_lookup): Likewise.
|
|
libnetfs has two kind of nodes, struct node and struct netnode.
struct node is used to store libnetfs specific data, while struct
netnode contains user supplied data. Previously, both objects were
allocated separatly, and a pointer from the node to the netnode
provided a mapping from the former to the latter.
Provide a function netfs_make_node_alloc that allocates both nodes in
a contiguous region.
This reduces the memory allocation overhead when creating nodes. It
also makes the relation between node and netnode a simple offset
calculation. Provide two functions to compute the netnode address
from the node address and vice-versa.
Most notably, this makes implementing a cache on top of libnetfs
easier. Auxiliary data for the cache can be stored in the
user-defined netnode, and the fat node can be used as the value.
* libnetfs/make-node.c (init_node): Move initialization here.
(netfs_make_node): Use init_node.
(netfs_make_node_alloc): New function to allocate fat nodes.
* libnetfs/netfs.h (netfs_make_node_alloc): New declaration.
(_netfs_sizeof_struct_node): Likewise.
(netfs_node_netnode): Compute netnode address from node address.
(netfs_netnode_node): And vice-versa.
* libnetfs/init-init.c (_netfs_sizeof_struct_node): New variable.
|
|
libdiskfs has two kind of nodes, struct node and struct netnode.
struct node is used to store libdiskfs specific data, while struct
netnode contains user supplied data. Previously, both objects were
allocated separatly, and a pointer from the node to the netnode
provided a mapping from the former to the latter.
Provide a function diskfs_make_node_alloc that allocates both nodes in
a contiguous region.
This reduces the memory allocation overhead when creating nodes. It
also makes the relation between node and netnode a simple offset
calculation. Provide two functions to compute the netnode address
from the node address and vice-versa.
Most notably, this makes implementing a cache on top of libdiskfs
easier. Auxiliary data for the cache can be stored in the
user-defined netnode, and the fat node can be used as the value.
* libdiskfs/node-make.c (init_node): Move initialization here.
(diskfs_make_node): Use init_node.
(diskfs_make_node_alloc): New function to allocate fat nodes.
* libdiskfs/diskfs.h (diskfs_make_node_alloc): New declaration.
(_diskfs_sizeof_struct_node): Likewise.
(diskfs_node_disknode): Compute disknode address from node address.
(diskfs_disknode_node): And vice-versa.
* libdiskfs/init-init.c (_diskfs_sizeof_struct_node): New variable.
|
|
* rootdir.c (rootdir_gc_slabinfo): Do not zero-terminate the generated
content.
|
|
* libtrivfs/trivfs.h (struct trivfs_peropen): Use refcount_t for field
refcnt.
(struct trivfs_control): Remove unused field lock.
* libtrivfs/cntl-create.c (trivfs_create_control): Drop the mutex
initialization.
* libtrivfs/io-reauthenticate.c (trivfs_S_io_reauthenticate): Adjust
accordingly.
* libtrivfs/io-restrict-auth.c (trivfs_S_io_restrict_auth): Likewise.
* libtrivfs/open.c (trivfs_open): Initialize refcnt.
* libtrivfs/protid-clean.c (trivfs_clean_protid): Likewise.
* libtrivfs/protid-dup.c (trivfs_protid_dup): Likewise.
|
|
Recently libihash was changed to use an integer hash function on the
keys in an attempt to reduce the rate of collisions (2d898893), which
has long been assumed to be high.
Richard Braun was kind enough to run some benchmarks. He observed:
"1/ Using an extremely simple microbenchmark [1] that merely inserts
keys, either random integers or sequential ones to match the way port
names are managed, it seems that the previous code, despite its
apparent flaws, did quite well.
[1] http://darnassus.sceen.net/gitweb/rbraun/ihtest.git
Using an integer hashing function actually reduces performance on the
sequential integer test case. It makes sense because, considering a
set of consecutive integers starting from 0, and a hash table that
always has more slots than items, a modulo is a perfect hash
function. Even when taking into account that only names for receive
rights are normally managed with libihash, i.e. that keys aren't
actually sequential, they are almost all equally distributed, leading
to very few collisions.
Therefore, as a third option, I've removed the hashing function,
leaving only a fast modulo (an AND) and this variant provided the best
raw results.
2/ I've also built hurd packages multiple times and got average build
times with each variant (previous, new, new without hash function) and
here are the results I obtained respectively : 52m59s, 52m31s, 52m22s."
Do not use the integer hash function on the keys by default.
* libihash/ihash.c (murmur3_mix32): Remove now unused function.
(find_index): Use the fast division method to derive the index.
(add_one): Likewise. Also, update the comment to reflect the current
hashing method.
|
|
* libdiskfs/name-cache.c (diskfs_check_lookup_cache): Release node
reference in a special case of lookup failure.
|
|
* trans/mtab.c (main): Fix initialization of mtab in one-shot mode.
|
|
This fixes a bug introduced in 86122789.
* ext2fs/pager.c (diskfs_pager_users): We count file_pager_bucket,
which does not include the disk pagers. Fix condition accordingly.
|
|
* libpager/priv.h (struct pager): Drop fields next, pprev.
|
|
I tested this change for some days and have not experienced any
problems with it.
* term/users.c (pi_destroy_hook): Fix memory leak.
|
|
Make empty bodies of control flow statements more explicit. Doing so
will allow us to use stricter compiler settings. This would have
cought 4ece292c.
* console-client/xkb/xkb.c: Make empty bodies more explicit
* libpipe/pipe.c: Likewise.
* mach-defpager/default_pager.c: Likewise.
* pfinet/linux-src/net/ipv4/fib_hash.c: Likewise.
* pflocal/connq.c: Likewise.
* pflocal/socket.c: Likewise.
|