mcoverlayfs: supported only Linux kernel 4.0
This commit is contained in:
@ -59,9 +59,18 @@ mem="512M@0"
|
|||||||
cpus=""
|
cpus=""
|
||||||
ihk_ikc_irq_core=0
|
ihk_ikc_irq_core=0
|
||||||
|
|
||||||
kernel_release=`uname -r`
|
release=`uname -r`
|
||||||
enable_mcoverlay=`if [[ ${kernel_release} =~ ^4.* && "${ENABLE_MCOVERLAYFS}" == "yes" ]]; then echo "yes"; fi`
|
major=`echo ${release} | sed -e 's/^\([0-9]*\).*/\1/'`
|
||||||
|
minor=`echo ${release} | sed -e 's/^[0-9]*.\([0-9]*\).*/\1/'`
|
||||||
|
patch=`echo ${release} | sed -e 's/^[0-9]*.[0-9]*.\([0-9]*\).*/\1/'`
|
||||||
|
linux_version_code=`expr \( ${major} \* 65536 \) + \( ${minor} \* 256 \) + ${patch}`
|
||||||
|
rhel_release=`echo ${release} | sed -e 's/^[0-9]*.[0-9]*.[0-9]*-\([0-9]*\).*/\1/'`
|
||||||
|
if [ "${release}" == "${rhel_release}" ]; then rhel_release=""; fi
|
||||||
|
if [ "${ENABLE_MCOVERLAYFS}" == "yes" ]; then
|
||||||
|
enable_mcoverlay=`if ( [ ${linux_version_code} -ge 262144 ] && [ ${linux_version_code} -lt 262400 ] ); then echo "yes"; else echo "no"; fi`
|
||||||
|
else
|
||||||
|
enable_mcoverlay=no
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$cpus" == "" ]; then
|
if [ "$cpus" == "" ]; then
|
||||||
# Get the number of CPUs on NUMA node 0
|
# Get the number of CPUs on NUMA node 0
|
||||||
@ -79,7 +88,7 @@ if [ "`lsmod | grep mcctrl`" != "" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove mcoverlay if loaded
|
# Remove mcoverlay if loaded
|
||||||
if [ "$enable_mcoverlay" != "" ]; then
|
if [ "$enable_mcoverlay" == "yes" ]; then
|
||||||
if [ "`lsmod | grep mcoverlay`" != "" ]; then
|
if [ "`lsmod | grep mcoverlay`" != "" ]; then
|
||||||
if [ "`cat /proc/mounts | grep /tmp/mcos/mcos0_sys`" != "" ]; then umount -l /tmp/mcos/mcos0_sys; fi
|
if [ "`cat /proc/mounts | grep /tmp/mcos/mcos0_sys`" != "" ]; then umount -l /tmp/mcos/mcos0_sys; fi
|
||||||
if [ "`cat /proc/mounts | grep /tmp/mcos/mcos0_proc`" != "" ]; then umount -l /tmp/mcos/mcos0_proc; fi
|
if [ "`cat /proc/mounts | grep /tmp/mcos/mcos0_proc`" != "" ]; then umount -l /tmp/mcos/mcos0_proc; fi
|
||||||
@ -149,7 +158,7 @@ if ! ${SBINDIR}/ihkosctl 0 boot; then echo "error: booting"; exit; fi
|
|||||||
if ! insmod ${KMODDIR}/mcctrl.ko; then echo "error: inserting mcctrl.ko"; exit; fi
|
if ! insmod ${KMODDIR}/mcctrl.ko; then echo "error: inserting mcctrl.ko"; exit; fi
|
||||||
if ! chown `logname` /dev/mcd* /dev/mcos*; then echo "error: chowning device files"; exit; fi
|
if ! chown `logname` /dev/mcd* /dev/mcos*; then echo "error: chowning device files"; exit; fi
|
||||||
|
|
||||||
if [ "$enable_mcoverlay" != "" ]; then
|
if [ "$enable_mcoverlay" == "yes" ]; then
|
||||||
if [ ! -e /tmp/mcos ]; then mkdir -p /tmp/mcos; fi
|
if [ ! -e /tmp/mcos ]; then mkdir -p /tmp/mcos; fi
|
||||||
if ! mount -t tmpfs tmpfs /tmp/mcos; then echo "error: mount /tmp/mcos"; exit; fi
|
if ! mount -t tmpfs tmpfs /tmp/mcos; then echo "error: mount /tmp/mcos"; exit; fi
|
||||||
if [ ! -e /tmp/mcos/linux_proc ]; then mkdir -p /tmp/mcos/linux_proc; fi
|
if [ ! -e /tmp/mcos/linux_proc ]; then mkdir -p /tmp/mcos/linux_proc; fi
|
||||||
|
|||||||
@ -4,9 +4,15 @@ KMODDIR=@KMODDIR@
|
|||||||
src = @abs_srcdir@
|
src = @abs_srcdir@
|
||||||
ENABLE_MCOVERLAYFS=@ENABLE_MCOVERLAYFS@
|
ENABLE_MCOVERLAYFS=@ENABLE_MCOVERLAYFS@
|
||||||
|
|
||||||
RELEASE=$(shell uname -r | cut -d"." -f1)
|
RELEASE=$(shell uname -r)
|
||||||
|
MAJOR=$(shell echo ${RELEASE} | sed -e 's/^\([0-9]*\).*/\1/')
|
||||||
|
MINOR=$(shell echo ${RELEASE} | sed -e 's/^[0-9]*.\([0-9]*\).*/\1/')
|
||||||
|
PATCH=$(shell echo ${RELEASE} | sed -e 's/^[0-9]*.[0-9]*.\([0-9]*\).*/\1/')
|
||||||
|
LINUX_VERSION_CODE=$(shell expr \( ${MAJOR} \* 65536 \) + \( ${MINOR} \* 256 \) + ${PATCH})
|
||||||
|
RHEL_RELEASE=$(shell echo ${RELEASE} | sed -e 's/^[0-9]*.[0-9]*.[0-9]*-\([0-9]*\).*/\1/')
|
||||||
|
RHEL_RELEASE=$(shell if [ "${RELEASE}" == "${RHEL_RELEASE}" ]; then echo ""; else echo ${RHEL_RELEASE}; fi)
|
||||||
ifeq ($(ENABLE_MCOVERLAYFS),yes)
|
ifeq ($(ENABLE_MCOVERLAYFS),yes)
|
||||||
ENABLE_BUILD=$(shell if [ "${RELEASE}" == "4" ]; then echo "yes"; fi)
|
ENABLE_BUILD=$(shell if ( [ ${LINUX_VERSION_CODE} -ge 262144 ] && [ ${LINUX_VERSION_CODE} -lt 262400 ] ); then echo "yes"; else echo "no"; fi)
|
||||||
else
|
else
|
||||||
ENABLE_BUILD=no
|
ENABLE_BUILD=no
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -1091,7 +1091,7 @@ void init_worker_threads(int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_MCOVERLAYFS
|
#ifdef ENABLE_MCOVERLAYFS
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
|
||||||
#define READ_BUFSIZE 1024
|
#define READ_BUFSIZE 1024
|
||||||
static int isunshare(void)
|
static int isunshare(void)
|
||||||
{
|
{
|
||||||
@ -1353,7 +1353,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_MCOVERLAYFS
|
#ifdef ENABLE_MCOVERLAYFS
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
|
||||||
__dprintf("mcoverlay enable\n");
|
__dprintf("mcoverlay enable\n");
|
||||||
char mcos_procdir[PATH_MAX];
|
char mcos_procdir[PATH_MAX];
|
||||||
char mcos_sysdir[PATH_MAX];
|
char mcos_sysdir[PATH_MAX];
|
||||||
@ -1401,7 +1401,7 @@ int main(int argc, char **argv)
|
|||||||
} else if (error == -1) {
|
} else if (error == -1) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif // LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
|
#endif
|
||||||
#else
|
#else
|
||||||
__dprintf("mcoverlay disable\n");
|
__dprintf("mcoverlay disable\n");
|
||||||
#endif // ENABLE_MCOVERLAYFS
|
#endif // ENABLE_MCOVERLAYFS
|
||||||
@ -1737,9 +1737,11 @@ int close_cloexec_fds(int mcos_fd)
|
|||||||
char *
|
char *
|
||||||
chgpath(char *in, char *buf)
|
chgpath(char *in, char *buf)
|
||||||
{
|
{
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0)
|
#ifdef ENABLE_MCOVERLAYFS
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
|
||||||
return in;
|
return in;
|
||||||
#else
|
#endif
|
||||||
|
#endif // ENABLE_MCOVERLAYFS
|
||||||
char *fn = in;
|
char *fn = in;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
@ -1760,7 +1762,6 @@ chgpath(char *in, char *buf)
|
|||||||
if(stat(fn, &sb) == -1)
|
if(stat(fn, &sb) == -1)
|
||||||
return in;
|
return in;
|
||||||
return fn;
|
return fn;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main_loop(int fd, int cpu, pthread_mutex_t *lock)
|
int main_loop(int fd, int cpu, pthread_mutex_t *lock)
|
||||||
|
|||||||
Reference in New Issue
Block a user