summaryrefslogtreecommitdiff
path: root/src/readahead
AgeCommit message (Collapse)Author
2013-10-13Introduce udev object cleanup functionsZbigniew Jędrzejewski-Szmek
2013-10-13ModernizationZbigniew Jędrzejewski-Szmek
Fixes minor leak in error path in device.c.
2013-10-13Never call qsort on potentially NULL arraysZbigniew Jędrzejewski-Szmek
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.
2013-08-20Rename F_TYPE_CMP() to F_TYPE_EQUAL()Zbigniew Jędrzejewski-Szmek
2013-08-16build-sys: Add configure check for linux/btrfs.hMichael Marineau
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 ]
2013-08-13missing: use btrfs.h instead of defining our own btrfs structuresLennart Poettering
2013-04-25readahead: fix format string issueZbigniew Jędrzejewski-Szmek
(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.
2013-04-24readahead: be more verbose about creation failuresZbigniew Jędrzejewski-Szmek
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.
2013-04-24Add set_consume which always takes ownershipZbigniew Jędrzejewski-Szmek
Freeing in error path is the common pattern with set_put().
2013-04-19Reintroduce f_type comparison macroHarald Hoyer
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
2013-04-18Revert f_type fixupsHarald Hoyer
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 ); \ })
2013-04-18move _cleanup_ attribute in front of the typeHarald Hoyer
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18rename CMP_F_TYPE to F_TYPE_CMPHarald Hoyer
2013-04-18Add ugly CMP_F_TYPE() macroHarald Hoyer
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.
2013-04-17fixup for cddf148028f52Harald Hoyer
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!!!!!!
2013-04-17fixup 8c68a7017 and cast to (unsigned long)Harald Hoyer
2013-04-17fixed statfs.f_type signed vs unsigned comparisonsHarald Hoyer
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
2013-04-14readahead-analyze: avoid division-by-0Zbigniew Jędrzejewski-Szmek
Also remove a few casts and use _cleanup_fclose_ to simplify logic.
2013-04-11errno is positiveZbigniew Jędrzejewski-Szmek
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.
2013-04-05Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek
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.
2013-04-03util: rename parse_usec() to parse_sec() sinds the default unit is secondsLennart Poettering
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.
2013-04-03util: rename write_one_line_file() to write_string_file()Lennart Poettering
You can write much more than just one line with this call (and we frequently do), so let's correct the naming.
2013-03-31Partially revert e62d8c394474Zbigniew Jędrzejewski-Szmek
The ~80 chars per line part wasn't well received.
2013-03-31ModernizationZbigniew Jędrzejewski-Szmek
Use _cleanup_ and wrap lines to ~80 chars and such.
2013-03-26readahead: cleanupsAuke Kok
- check for OOM - no need to use floats and round()
2013-03-26readahead: chunk on spinning mediaAuke Kok
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).
2013-03-11Remove or indent #define GNU_SOURCEZbigniew Jędrzejewski-Szmek
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.
2013-02-14honor SELinux labels, when creating and writing config filesHarald Hoyer
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
2013-02-13Revert "log_error() if inotify_add_watch() fails"Lennart Poettering
This reverts commit 2826d14091e43ed3397d862dee79d09d0115c84e. We never should generate log messages from a library.
2013-02-13log_error() if inotify_add_watch() failsHarald Hoyer
[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.]
2013-01-03readahead: don't complain that we cannot precache symlinksLennart Poettering
http://lists.freedesktop.org/archives/systemd-devel/2012-December/007847.html
2012-11-22readahead: properly detect btrfs on SSDLennart Poettering
2012-10-22readahead: fix fd validity checkMichal Schmidt
https://bugzilla.redhat.com/show_bug.cgi?id=868603
2012-09-13readahead: use 20K instead of 16K as temporary request nr bumpLennart Poettering
2012-09-04missing: define name_to_handle_at on our own if it is missingLennart Poettering
2012-09-03readahead: a bit of reformattingLennart Poettering
2012-08-23readahead-analyze: don't call fclose on nullLukas Nykryn
2012-08-08fix a couple of issues found with llvm-analyzeLennart Poettering
2012-07-26log.h: new log_oom() -> int -ENOMEM, use itShawn Landden
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
2012-07-25use "Out of memory." consistantly (or with "\n")Shawn Landden
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
2012-07-19use #pragma once instead of foo*foo #define guardsShawn Landden
#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
2012-07-03readahead: fix calculation of percentageLennart Poettering
2012-06-22journal: fix sd_journal_stream_fd()Lennart Poettering
2012-06-22readahead: minor code style fixesLennart Poettering
2012-06-22readahead: make sure to close pack file before exiting, to be valgrind cleanLennart Poettering
2012-06-21readahead: use log_error() for logging errorsLennart Poettering
2012-06-21readahead: make use of util.h's page_size() callLennart Poettering
2012-06-21readahead: merge three binaries into oneLennart Poettering
since the binaries share much of the same code and we better load only one binary instead of two from disk at early boot let's merge the three readahead binaries into one. This also allows us to drop a lot of duplicated code.
2012-06-05readahead: Add tool to analyze the contents of the pack file. v3.Auke Kok
This patch adds code to compile 'systemd-readahead-analyze' and install it into $bindir. Use this program to parse the contents of the readahead pack file, or an arbitrary pack file and display which files are listed in it, and how much of the files are requested to be readahead. This code is not new - it's partially taken from sreadahead (formerly maintained by Arjan van der Ven and me, and was originally written by me), and adapted with the right bits to parse the systemd readahead pack files, which are slightly different in format. v2 adds a common READAHEAD_PACK_FILE_VERSION used in all the code to provide a quick way to assure all these programs are always synchronized. v3 fixes the integer math.
2012-05-23readahead: avoid running of readahead services if readahead is already doneLennart Poettering