summaryrefslogtreecommitdiff
path: root/src/extent-scan.c
AgeCommit message (Collapse)Author
2011-04-06copy: handle mergeable extents across fiemap scansPádraig Brady
* extent-scan.h (extent_scan_free): Init the pointer to NULL, and reset the count to 0, so that we can realloc the buffer. * src/extent-scan.c (extent_scan_init): Likewise. (extent_scan_read): Loop over multiple fiemap scans, so we handle mergeable extents that span across fiemap scan boundaries. Once we have enough unique extents, return so as to minimize memory use.
2011-04-03maint: prohibit direct use of strncmp: prefer STREQ_LEN, STRNCMP_LITJim Meyering
* cfg.mk (sc_prohibit_strncmp): New rule, mostly from libvirt. * src/system.h (STREQ_LEN, STRPREFIX, STRNCMP_LIT): Define. * src/df.c (get_dev, get_point): Convert. * src/extent-scan.c (extent_need_sync): Likewise. * src/ls.c (is_colored, decode_switches): Likewise. (parse_ls_color, (print_color_indicator): Likewise. * src/md5sum.c (split_3): Likewise. * src/split.c (main, emit_ancillary_info): Likewise. * src/tr.c (look_up_char_class): Likewise. * src/uname.c (main): Likewise. * src/who.c (scan_entries): Likewise.
2011-04-03copy: require fiemap sync also for 2.6.38 kernelsJim Meyering
* src/extent-scan.c (extent_need_sync): Require sync also for 2.6.38. Without this, part of the cp/fiemap-empty test would fail both on F15-to-be (2.6.38.1-6.fc15.x86_64) and rawhide. For details, see http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22190
2011-04-01copy: protect against overlapping extentsPádraig Brady
* src/extent-scan.c (extent_scan_read): Add a more stringent check for OFF_T overflow, to ensure subsequent code is immune. Detect overlapping extents and adjust, so as files always copied. Detection using a single scan with fallback to a standard copy was thought too expensive in memory or time. * NEWS: Mention the fix
2011-03-31copy: with fiemap copy, only sync when neededPádraig Brady
* src/extent-scan.h (struct extent_scan): Add the fm_flags member to pass to the fiemap scan. * src/extent-scan.c (extent_need_sync): A new function used to detect Linux kernels before 2.6.38. (extent_scan_init): Add FIEMAP_FLAG_SYNC when needed. * tests/cp/sparse-fiemap: Adjust comment. * NEWS: Mention the change in behavior. Indirectly suggested by Mike Frysinger
2011-03-11copy: merge similar extents before processingPádraig Brady
* src/extent-scan.c (extent_scan_read): Merge adjacent extents that vary only in size, so that we may process them more efficiently. This will be especially useful when we introduce fallocate() so that we don't reproduce fragmentation in the destination.
2011-02-04cp: avoid spurious failure on any non-linux kernelJim Meyering
* src/extent-scan.c (extent_scan_read) [!linux]: Always set scan->initial_scan_failed so caller knows not to report the failure.
2011-01-31maint: update copyright year lists in new filesJim Meyering
* src/extent-scan.h: Update copyright year list. * src/extent-scan.c: Likewise. * tests/cp/sparse-fiemap: Likewise.
2011-01-30extent-scan: adjust naming and formattingJim Meyering
* src/extent-scan.h [struct extent_scan]: Rename member: s/hit_last_extent/hit_final_extent/. "final" is clearer, since "last" can be interpreted as "preceding". Rename extent-scan functions to start with extent_scan_. * src/Makefile.am (copy_sources): Also distribute extent-scan.h. * src/extent-scan.c: Don't include error.h or quote.h. Neither is used. * src/copy.c: shorten a comment to fit in 80 columns * src/extent-scan.c, src/extent-scan.h: Correct formatting.
2011-01-30fiemap copy: add extent-scan.[ch], avoid a double-free and reorganizejeff.liu
Changes: ======== 1. fix write_zeros() per Jim's comments. 2. remove char const *fname from struct extent_scan. 3. change the signature of open_extent_scan() from "void open_extent_scan(struct extent_scan **scan)" to "void open_extent_scan(struct extent_scan *scan)" to avoid having to malloc the extent_scan variable; instead save it on the stack. 4. move close_extent_scan() from a function defined in extent-scan.c to extent-scan.h as a macro definition, but it does nothing for now, since initial extent scan defined at stack. 5. add a macro "free_extents_info()" defined at extent-scan.h to release the memory allocated to extent info which should be called combine with get_extents_info(), it just one line, so IMHO, define it as macro should be ok. * src/extent-scan.c: New file; functions to read "extents". * src/extent-scan.h: Header file of extent-scan.c. * src/Makefile.am: Reference it and link it to copy_source. * src/copy.c: Use the new functions and avoid double-free.