summaryrefslogtreecommitdiff
path: root/src/readahead
Commit message (Collapse)AuthorAge
* util: use alloca0() intead of alloca() + memzero()Lennart Poettering2014-01-31
|
* use memzero(foo, length); for all memset(foo, 0, length); callsGreg KH2014-01-31
| | | | | | | | In trying to track down a stupid linker bug, I noticed a bunch of memset() calls that should be using memzero() to make it more "obvious" that the options are correct (i.e. 0 is not the length, but the data to set). So fix up all current calls to memset(foo, 0, length) to memzero(foo, length).
* clients: unify how we invoke getopt_long()Lennart Poettering2013-11-06
| | | | | Among other things this makes sure we always expose a --version command and show it in the help texts.
* Introduce udev object cleanup functionsZbigniew Jędrzejewski-Szmek2013-10-13
|
* ModernizationZbigniew Jędrzejewski-Szmek2013-10-13
| | | | Fixes minor leak in error path in device.c.
* Never call qsort on potentially NULL arraysZbigniew Jędrzejewski-Szmek2013-10-13
| | | | | | This extends 62678ded 'efi: never call qsort on potentially NULL arrays' to all other places where qsort is used and it is not obvious that the count is non-zero.
* Rename F_TYPE_CMP() to F_TYPE_EQUAL()Zbigniew Jędrzejewski-Szmek2013-08-20
|
* build-sys: Add configure check for linux/btrfs.hMichael Marineau2013-08-16
| | | | | | | | | | | btrfs.h was added to uapi in Linux 3.9. To fix building with older header versions this adds a configure check for the header and re-adds btrfs definitions to missing.h which was removed in bed2e820 along with two other ioctls used by gpt-auto-generator. [ Apparently, btrfs.h was only added recently: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=55e301fd57a6239ec14b91a1cf2e70b3dd135194 let's re-add it for now -- kay ]
* missing: use btrfs.h instead of defining our own btrfs structuresLennart Poettering2013-08-13
|
* readahead: fix format string issueZbigniew Jędrzejewski-Szmek2013-04-25
| | | | | (struct stat).st is off_t, which usually is a long, or a long long. There's no good format string modifier for it, so use a cast.
* readahead: be more verbose about creation failuresZbigniew Jędrzejewski-Szmek2013-04-24
| | | | | | systemd-readahead reports "Failed to create shared memory segment: No such file or directory", but it's unclear how it can happen. Be more verbose about failures.
* Add set_consume which always takes ownershipZbigniew Jędrzejewski-Szmek2013-04-24
| | | | Freeing in error path is the common pattern with set_put().
* Reintroduce f_type comparison macroHarald Hoyer2013-04-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4826f0b7b5c0aefa08b8cc7ef64d69027f84da2c. Because statfs.t_type can be int on some architecures, we have to cast the const magic to the type, otherwise the compiler warns about signed/unsigned comparison, because the magic can be 32 bit unsigned. statfs(2) man page is also wrong on some systems, because f_type is not __SWORD_TYPE on some architecures. The following program: int main(int argc, char**argv) { struct statfs s; statfs(argv[1], &s); printf("sizeof(f_type) = %d\n", sizeof(s.f_type)); printf("sizeof(__SWORD_TYPE) = %d\n", sizeof(__SWORD_TYPE)); printf("sizeof(long) = %d\n", sizeof(long)); printf("sizeof(int) = %d\n", sizeof(int)); if (sizeof(s.f_type) == sizeof(int)) { printf("f_type = 0x%x\n", s.f_type); } else { printf("f_type = 0x%lx\n", s.f_type); } return 0; } executed on s390x gives for a btrfs: sizeof(f_type) = 4 sizeof(__SWORD_TYPE) = 8 sizeof(long) = 8 sizeof(int) = 4 f_type = 0x9123683e
* Revert f_type fixupsHarald Hoyer2013-04-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit a858b64dddf79177e12ed30f5e8c47a1471c8bfe. This reverts commit aea275c43194b6ac519ef907b62c5c995050fde0. This reverts commit fc6e6d245ee3989c222a2a8cc82a33475f9922f3. This reverts commit c4073a27c555aeceac87a3b02a83141cde641a1e. This reverts commit cddf148028f525be8176e7f1cbbf4f862bd287f6. This reverts commit 8c68a70170b31f93c287f29fd06c6c17edaf19ad. The constants are now casted to __SWORD_TYPE, which should resolve the compiler warnings about signed vs unsigned. After talking to Kay, we concluded: This should be fixed in the kernel, not worked around in userspace tools. Architectures cannot use int and expect magic constants lager than INT_MAX to work correctly. The kernel header needs to be fixed. Even coreutils cannot handle it: #define RAMFS_MAGIC 0x858458f6 # stat -f -c%t / ffffffff858458f6 #define BTRFS_SUPER_MAGIC 0x9123683E # stat -f -c%t /mnt ffffffff9123683e Although I found the perfect working macro to fix the thing :) __extension__ ({ \ bool _ret = false; \ switch(f) { case c: _ret=true; }; \ ( _ret ); \ })
* move _cleanup_ attribute in front of the typeHarald Hoyer2013-04-18
| | | | http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
* rename CMP_F_TYPE to F_TYPE_CMPHarald Hoyer2013-04-18
|
* Add ugly CMP_F_TYPE() macroHarald Hoyer2013-04-18
| | | | | | | | | | | | | | | | | | On some architectures (like s390x) the kernel has the type int for f_type, but long in userspace. Assigning the 32 bit magic constants from linux/magic.h to the 31 bit signed f_type in the kernel, causes f_type to be negative for some constants. glibc extends the int to long for those architecures in 64 bit mode, so the negative int becomes a negative long, which cannot be simply compared to the original magic constant, because the compiler would automatically cast the constant to long. To workaround this issue, we also compare to the (int)MAGIC value in a macro. Of course, we could do #ifdef with the architecure, but it has to be maintained, and the magic constants are 32 bit anyway. Someday, when the int is unsigned or long for all architectures, we can remove this macro again. Until then, keep it as simple as it can be.
* fixup for cddf148028f52Harald Hoyer2013-04-17
| | | | | | | | Instead of making a type up, just use __SWORD_TYPE, after reading statfs(2). Too bad, this does not fix s390x because __SWORD_TYPE is (long int) and the kernel uses (int) to fill in the field!!!!!!
* fixup 8c68a7017 and cast to (unsigned long)Harald Hoyer2013-04-17
|
* fixed statfs.f_type signed vs unsigned comparisonsHarald Hoyer2013-04-17
| | | | | | | | | | | | statfs.f_type is signed but the filesystem magics are unsigned. Casting the magics to signed will not make the signed. Problem seen on big-endian 64bit s390x with __fsword_t 8 bytes. Casting statfs.f_type to unsigned on the other hand will get us what we need. https://bugzilla.redhat.com/show_bug.cgi?id=953217
* readahead-analyze: avoid division-by-0Zbigniew Jędrzejewski-Szmek2013-04-14
| | | | Also remove a few casts and use _cleanup_fclose_ to simplify logic.
* errno is positiveZbigniew Jędrzejewski-Szmek2013-04-11
| | | | | | | | | | Make sure we compare errno against positive error codes. The ones in hwclock.c and install.c can have an impact, the rest are unlikely to be hit or in code that isn't widely used. Also check that errno > 0, to help gcc know that we are returning a negative error code.
* Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek2013-04-05
| | | | | | | | | | | | | | | | | | | | | | | Before, we would initialize many fields twice: first by filling the structure with zeros, and then a second time with the real values. We can let the compiler do the job for us, avoiding one copy. A downside of this patch is that text gets slightly bigger. This is because all zero() calls are effectively inlined: $ size build/.libs/systemd text data bss dec hex filename before 897737 107300 2560 1007597 f5fed build/.libs/systemd after 897873 107300 2560 1007733 f6075 build/.libs/systemd … actually less than 1‰. A few asserts that the parameter is not null had to be removed. I don't think this changes much, because first, it is quite unlikely for the assert to fail, and second, an immediate SEGV is almost as good as an assert.
* util: rename parse_usec() to parse_sec() sinds the default unit is secondsLennart Poettering2013-04-03
| | | | | | | | Internally we store all time values in usec_t, however parse_usec() actually was used mostly to parse values in seconds (unless explicit units were specified to define a different unit). Hence, be clear about this and name the function about what we pass into it, not what we get out of it.
* util: rename write_one_line_file() to write_string_file()Lennart Poettering2013-04-03
| | | | | You can write much more than just one line with this call (and we frequently do), so let's correct the naming.
* Partially revert e62d8c394474Zbigniew Jędrzejewski-Szmek2013-03-31
| | | | The ~80 chars per line part wasn't well received.
* ModernizationZbigniew Jędrzejewski-Szmek2013-03-31
| | | | Use _cleanup_ and wrap lines to ~80 chars and such.
* readahead: cleanupsAuke Kok2013-03-26
| | | | | - check for OOM - no need to use floats and round()
* readahead: chunk on spinning mediaAuke Kok2013-03-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Readahead has all sorts of bad side effects depending on your storage media. On rotating disks, it may be degrading startup performance if enough requests are queued spanning linearly over all blocks early at boot, and mount, blkid and friends want to insert reads to the start of these block devices after. The end result is that on spinning disks with ext3/4 that udev and mounts take a very long time, and nothing really happens until readahead is completely finished. This has the net effect that the CPU is almost entirely idle for the entire period that readahead is working. We could have finished starting up quite a lot of services in this time if we were smarter at how we do readahead. This patch sorts all requests into 2 second "chunks" and sub-sorts each chunk by block. This adds a single cross-drive seek per "chunk" but has the benefit that we will have a lot of the blocks we need early on in the boot sequence loaded into memory faster. For a comparison of how before/after bootcharts look (ext4 on a mobile 5400rpm 250GB drive) please look at: http://foo-projects.org/~sofar/blocked-tests/ There are bootcharts in the "before" and "after" folders where you should be able to see that many low-level services finish 5-7 seconds earlier with the patch applied (after).
* Remove or indent #define GNU_SOURCEZbigniew Jędrzejewski-Szmek2013-03-11
| | | | | | | It is only needed in files designed to be usable in standalone compilation. In those files the #ifdefinery is indented. When compiling in-tree, GNU_SOURCE is always defined, so remove one definition.
* honor SELinux labels, when creating and writing config filesHarald Hoyer2013-02-14
| | | | | | | Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
* Revert "log_error() if inotify_add_watch() fails"Lennart Poettering2013-02-13
| | | | | | This reverts commit 2826d14091e43ed3397d862dee79d09d0115c84e. We never should generate log messages from a library.
* log_error() if inotify_add_watch() failsHarald Hoyer2013-02-13
| | | | | | | [zj: Reworded message s/to watch/to add watch on/ to make it clear that it was the watch init action that failed, and not the "process of watching". I think this way it'll be clearer to people who don't know what inotify does.]
* readahead: don't complain that we cannot precache symlinksLennart Poettering2013-01-03
| | | | http://lists.freedesktop.org/archives/systemd-devel/2012-December/007847.html
* readahead: properly detect btrfs on SSDLennart Poettering2012-11-22
|
* readahead: fix fd validity checkMichal Schmidt2012-10-22
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=868603
* readahead: use 20K instead of 16K as temporary request nr bumpLennart Poettering2012-09-13
|
* missing: define name_to_handle_at on our own if it is missingLennart Poettering2012-09-04
|
* readahead: a bit of reformattingLennart Poettering2012-09-03
|
* readahead-analyze: don't call fclose on nullLukas Nykryn2012-08-23
|
* fix a couple of issues found with llvm-analyzeLennart Poettering2012-08-08
|
* log.h: new log_oom() -> int -ENOMEM, use itShawn Landden2012-07-26
| | | | | | also a number of minor fixups and bug fixes: spelling, oom errors that didn't print errors, not properly forwarding error codes, few more consistency issues, et cetera
* use "Out of memory." consistantly (or with "\n")Shawn Landden2012-07-25
| | | | | | | | glibc/glib both use "out of memory" consistantly so maybe we should consider that instead of this. Eliminates one string out of a number of binaries. Also fixes extra newline in udev/scsi_id
* use #pragma once instead of foo*foo #define guardsShawn Landden2012-07-19
| | | | | | | | | | | | | | | | | #pragma once has been "un-deprecated" in gcc since 3.3, and is widely supported in other compilers. I've been using and maintaining (rebasing) this patch for a while now, as it annoyed me to see #ifndef fooblahfoo, etc all over the place, almost arrogant about the annoyance of having to define all these names to perform a commen but neccicary functionality, when a completely superior alternative exists. I havn't sent it till now, cause its kindof a style change, and it is bad voodoo to mess with style that has been established by more established editors. So feel free to lambast me as a crazy bafoon. v2 - preserve externally used headers
* readahead: fix calculation of percentageLennart Poettering2012-07-03
|
* journal: fix sd_journal_stream_fd()Lennart Poettering2012-06-22
|
* readahead: minor code style fixesLennart Poettering2012-06-22
|
* readahead: make sure to close pack file before exiting, to be valgrind cleanLennart Poettering2012-06-22
|
* readahead: use log_error() for logging errorsLennart Poettering2012-06-21
|
* readahead: make use of util.h's page_size() callLennart Poettering2012-06-21
|