#!/bin/bash
PROG=$(basename $0)
[ "$1" = "-h" -o "$1" = "--help" ] && echo "usage: $PROG [patch dir]" && exit 0
-[ "$1" = "-d" ] && shift && DELETE="git rm" || DELETE="echo"
-[ "$1" = "-v" ] && shift && VERBOSE="echo" || VERBOSE=":"
+[ "$1" = "-d" ] && shift && DELETE="git rm" || DELETE="echo Unused"
+[ "$1" = "-v" ] && shift && VERBOSE="echo Checking" || VERBOSE=":"
[ "$1" ] && BASEDIR="$1"
BASEDIR=${BASEDIR:-lustre/kernel_patches}
[ ! -d "$SERIESPATH" ] && echo "$PROG: missing series '$SERIESPATH'" && exit 2
[ ! -d "$PATCHPATH" ] && echo "$PROG: missing patches '$PATCHPATH'" && exit 3
-for PATCH in $(ls $PATCHPATH | egrep -v "CVS|~$|.orig|.rej"); do
+CANONICAL_SERIESPATH=$(readlink -f ${SERIESPATH})
+pushd $PATCHPATH > /dev/null
+for PATCH in $(find -name "*.patch"); do
+ # Remove the leading "./"
+ PATCH=${PATCH##./}
$VERBOSE $PATCH
- if ! grep -q $PATCH $SERIESPATH/*.series ; then
- $DELETE $PATCHPATH/$PATCH
+ if ! grep -q -e "^$PATCH" $CANONICAL_SERIESPATH/*.series ; then
+ $DELETE $PATCH
fi
done
+popd > /dev/null
[ "$1" = "-h" -o "$1" = "--help" ] && echo "usage: $PROG [patch dir]" && exit 0
[ "$1" = "-v" ] && shift && VERBOSE="echo" || VERBOSE=":"
+[ "$1" ] && BASEDIR="$1"
BASEDIR=${BASEDIR:-lustre/kernel_patches}
SERIESPATH=${SERIESPATH:-$BASEDIR/series}
PATCHPATH=${PATCHPATH:-$BASEDIR/patches}
[ ! -d "$SERIESPATH" ] && echo "$PROG: missing series '$SERIESPATH'" && exit 2
[ ! -d "$PATCHPATH" ] && echo "$PROG: missing patches '$PATCHPATH'" && exit 3
-for SERIES in $(ls $SERIESPATH | egrep -v "CVS|~$|.orig") ; do
+for SERIES in $(ls $SERIESPATH | egrep -v "~$|.orig|.rej") ; do
$VERBOSE "series: $SERIES"
for PATCH in $(grep -v "^#" $SERIESPATH/$SERIES); do
$VERBOSE $PATCH
- if [ ! $(find $PATCHPATH -name $PATCH) ]; then
+ if [ ! -e $PATCHPATH/$PATCH ]; then
echo "$SERIESPATH/$SERIES: patch '$PATCH' not found!"
fi
done
--- /dev/null
+This directory contains the patches needed to convert ext4 into ldiskfs.
+
+We need to be able to create a version of ldiskfs from the ext4 source
+code found in multiple versions of the kernel. That ext4 source code can
+vary quite a bit between different versions of the kernel, which means
+that it is impossible to maintain one set of patches that will cleanly
+apply to all versions of ext4.
+
+Where to put a new patch
+------------------------
+
+Therefore, we split the patches into multiple subdirectories in the
+"patches" directory. These subdirecotories are named after the
+version of the Linux distribution against which they were developed.
+For instance, "patches/rhel6.3" and "patches/sles11sp1".
+
+When creating a new patch, put it in the subdirectory for the
+distribution for which it was first created.
+
+Sharing patches
+---------------
+
+Often a patch will apply cleanly to multiple kernel's ext4 code.
+
+If a patch from a different distribution's subdirectory applies cleanly,
+it should be included directly in that distribution's series file rather
+than making a copy of the patch. As an example, lets consider two
+distribution directories:
+
+ patches/rhel6.3
+ patches/sles11sp1
+
+If a patch named "patches/rhel6.3/foo.patch" applies cleanly and is
+needed by the sles11sp1 ext4 code, the sles11sp1 series file should
+directly list "patches/rhel6.3/foo.patch". A copy of the same patch
+should only be made when the patch will not apply without changes.
+
+Refreshing patches for a new kernel/distribution
+------------------------------------------------
+
+When adding support for a new OS distribution release and its new
+version of the kernel, it is common to begin by copying the patch
+series file from a similar OS release. For instance, when beginning
+to add support for the RHEL 6.4 kernel, one might copy the
+series/ldiskfs-2.6-rhel6.3.series file to the new name
+series/ldiskfs-2.6-rhel6.4.series.
+
+When applying that series, some patches are likely to succeed and others
+to fail to apply. When a patch fails to apply, a copy of it should be
+made into a new distribution subdirectory before refreshing that patch.
+In this way, support for the new kernel may be added without breaking
+support for the previous kernel. As an example, if the patch:
+
+ patches/rhel6.3/foo.patch
+
+fails to apply as part of series/ldiskfs-2.6-rhel6.4.series, the developer
+would copy the patch to:
+
+ patches/rhel6.4/foo.patch
+
+The next step would be to edit series/ldiskfs-2.6-rhel6.4.series to point
+to the new patch. Finally, the developer may edit files and "quilt refresh"
+the new patch.
-ext4-wantedi-2.6-rhel6.patch
-ext4-map_inode_page-2.6.18-rhel5.patch
-export-ext4-2.6-rhel6.patch
-ext4-remove-cond_resched-calls-rhel5.patch
-ext4-nlink-2.6-rhel5.patch
-ext4-ext_generation-sles11.patch
-ext4-inode-version-rhel6.patch
-ext4-mmp-rhel6.patch
-ext4-lookup-dotdot-rhel5.patch
-ext4-max-dir-size-rhel6.patch
-ext4-print-inum-in-htree-warning-rhel6.patch
-ext4-xattr-no-update-ctime-rhel5.patch
-ext4-prealloc-rhel6.patch
-ext4-mballoc-extra-checks-rhel6.patch
-ext4-misc-rhel6.patch
-ext4-big-endian-check-2.6-rhel6.patch
-ext4-alloc-policy-2.6-rhel5.patch
-ext4-force_over_128tb-rhel6.patch
-ext4-pdir-fix-rhel6.patch
-ext4-osd-iop-common-rhel6.patch
-ext4-osd-iam-exports-rhel6.patch
-ext4-dynlocks-common-rhel6.patch
-ext4-hash-indexed-dir-dotdot-update-rhel5.patch
-ext4-kill-dx_root-rhel6.patch
-ext4-extents-mount-option-rhel6.patch
-ext4-fiemap-2.6-rhel6.patch
-ext4-mballoc-pa_free-mismatch-rhel6.patch
-ext4_data_in_dirent-rhel6.patch
-ext4-large-eas.patch
-ext4-disable-mb-cache-rhel6.patch
-ext4-back-dquot-to-rhel6.patch
-ext4-nocmtime-2.6-rhel5.patch
-ext4-vmalloc-rhel6.patch
-ext4-journal-callback.patch
-ext4-store-tree-generation-at-find.patch
-ext4_pdirop-rhel6.patch
-ext4-quota-force-block-alloc-quotaoff.patch
-ext4-quota-dont-update-cmtime.patch
-ext4-quota-first-class.patch
-ext4-inode_info_reorganize.patch
-ext4-fix-mbgroups-access.patch
-ext4-fix-ext4_mb_add_n_trim.patch
+rhel6.3/ext4-wantedi-2.6.patch
+rhel6.3/ext4-map_inode_page-2.6.18.patch
+rhel6.3/export-ext4-2.6.patch
+rhel6.3/ext4-remove-cond_resched-calls.patch
+rhel6.3/ext4-nlink-2.6.patch
+sles11sp1/ext4-ext_generation.patch
+rhel6.3/ext4-inode-version.patch
+rhel6.3/ext4-mmp.patch
+rhel6.3/ext4-lookup-dotdot.patch
+rhel6.3/ext4-max-dir-size.patch
+rhel6.3/ext4-print-inum-in-htree-warning.patch
+rhel6.3/ext4-xattr-no-update-ctime.patch
+rhel6.3/ext4-prealloc.patch
+rhel6.3/ext4-mballoc-extra-checks.patch
+rhel6.3/ext4-misc.patch
+rhel6.3/ext4-big-endian-check-2.6.patch
+rhel6.3/ext4-alloc-policy-2.6.patch
+rhel6.3/ext4-force_over_128tb.patch
+rhel6.3/ext4-pdir-fix.patch
+rhel6.3/ext4-osd-iop-common.patch
+rhel6.3/ext4-osd-iam-exports.patch
+rhel6.3/ext4-dynlocks-common.patch
+rhel6.3/ext4-hash-indexed-dir-dotdot-update.patch
+rhel6.3/ext4-kill-dx_root.patch
+rhel6.3/ext4-extents-mount-option.patch
+rhel6.3/ext4-fiemap-2.6.patch
+rhel6.3/ext4-mballoc-pa_free-mismatch.patch
+rhel6.3/ext4_data_in_dirent.patch
+rhel6.3/ext4-large-eas.patch
+rhel6.3/ext4-disable-mb-cache.patch
+rhel6.3/ext4-back-dquot-to.patch
+rhel6.3/ext4-nocmtime-2.6.patch
+rhel6.3/ext4-vmalloc.patch
+rhel6.3/ext4-journal-callback.patch
+rhel6.3/ext4-store-tree-generation-at-find.patch
+rhel6.3/ext4_pdirop.patch
+rhel6.3/ext4-quota-force-block-alloc-quotaoff.patch
+rhel6.3/ext4-quota-dont-update-cmtime.patch
+rhel6.3/ext4-quota-first-class.patch
+rhel6.3/ext4-inode_info_reorganize.patch
+rhel6.3/ext4-fix-mbgroups-access.patch
+rhel6.3/ext4-fix-ext4_mb_add_n_trim.patch
-ext4-wantedi-2.6-rhel6.patch
-ext4-map_inode_page-2.6.18-rhel5.patch
-export-ext4-2.6-rhel6.patch
-ext4-remove-cond_resched-calls-rhel5.patch
-ext4-nlink-2.6-rhel5.patch
-ext4-ext_generation-sles11.patch
-ext4-inode-version-rhel6.patch
-ext4-update-sles11-rhel6.patch
-ext4-mmp-rhel6.patch
-ext4-lookup-dotdot-rhel5.patch
-ext4-max-dir-size-rhel6.patch
-ext4-print-inum-in-htree-warning-rhel6.patch
-ext4-xattr-no-update-ctime-rhel5.patch
-ext4-prealloc-rhel6.patch
-ext4-mballoc-extra-checks-rhel6.patch
-ext4-misc-rhel6.patch
-ext4-big-endian-check-2.6-rhel6.patch
-ext4-alloc-policy-2.6-rhel5.patch
-ext4-force_over_128tb-rhel6.patch
-ext4-pdir-fix-rhel6.patch
-ext4-osd-iop-common-rhel6.patch
-ext4-osd-iam-exports-rhel6.patch
-ext4-dynlocks-common-rhel6.patch
-ext4-hash-indexed-dir-dotdot-update-rhel5.patch
-ext4-kill-dx_root-rhel6.patch
-ext4-extents-mount-option-rhel6.patch
-ext4-fiemap-2.6-rhel6.patch
-ext4-mballoc-pa_free-mismatch-rhel6.patch
-ext4_data_in_dirent-rhel6.patch
-ext4-large-eas.patch
-ext4-disable-mb-cache-rhel6.patch
-ext4-back-dquot-to-rhel6.patch
-ext4-nocmtime-2.6-rhel5.patch
-ext4-export-64bit-name-hash.patch
-ext4-vmalloc-rhel6.patch
-ext4-journal-callback.patch
-ext4-store-tree-generation-at-find.patch
-ext4_pdirop-rhel6.patch
-ext4-quota-force-block-alloc-quotaoff.patch
-ext4-quota-dont-update-cmtime.patch
-ext4-quota-first-class.patch
-ext4-fix-ext4_mb_add_n_trim.patch
+rhel6.3/ext4-wantedi-2.6.patch
+rhel6.3/ext4-map_inode_page-2.6.18.patch
+rhel6.3/export-ext4-2.6.patch
+rhel6.3/ext4-remove-cond_resched-calls.patch
+rhel6.3/ext4-nlink-2.6.patch
+sles11sp1/ext4-ext_generation.patch
+rhel6.3/ext4-inode-version.patch
+sles11sp1/ext4-update-sles11-rhel6.patch
+rhel6.3/ext4-mmp.patch
+rhel6.3/ext4-lookup-dotdot.patch
+rhel6.3/ext4-max-dir-size.patch
+rhel6.3/ext4-print-inum-in-htree-warning.patch
+rhel6.3/ext4-xattr-no-update-ctime.patch
+rhel6.3/ext4-prealloc.patch
+rhel6.3/ext4-mballoc-extra-checks.patch
+rhel6.3/ext4-misc.patch
+rhel6.3/ext4-big-endian-check-2.6.patch
+rhel6.3/ext4-alloc-policy-2.6.patch
+rhel6.3/ext4-force_over_128tb.patch
+rhel6.3/ext4-pdir-fix.patch
+rhel6.3/ext4-osd-iop-common.patch
+rhel6.3/ext4-osd-iam-exports.patch
+rhel6.3/ext4-dynlocks-common.patch
+rhel6.3/ext4-hash-indexed-dir-dotdot-update.patch
+rhel6.3/ext4-kill-dx_root.patch
+rhel6.3/ext4-extents-mount-option.patch
+rhel6.3/ext4-fiemap-2.6.patch
+rhel6.3/ext4-mballoc-pa_free-mismatch.patch
+rhel6.3/ext4_data_in_dirent.patch
+rhel6.3/ext4-large-eas.patch
+rhel6.3/ext4-disable-mb-cache.patch
+rhel6.3/ext4-back-dquot-to.patch
+rhel6.3/ext4-nocmtime-2.6.patch
+rhel6.3/ext4-export-64bit-name-hash.patch
+rhel6.3/ext4-vmalloc.patch
+rhel6.3/ext4-journal-callback.patch
+rhel6.3/ext4-store-tree-generation-at-find.patch
+rhel6.3/ext4_pdirop.patch
+rhel6.3/ext4-quota-force-block-alloc-quotaoff.patch
+rhel6.3/ext4-quota-dont-update-cmtime.patch
+rhel6.3/ext4-quota-first-class.patch
+rhel6.3/ext4-fix-ext4_mb_add_n_trim.patch