Merge branch 'mars0.1.y' into mars0.1a.y

This commit is contained in:
Thomas Schoebel-Theuer 2019-02-19 07:27:51 +01:00
commit 3634da40b1
7 changed files with 287 additions and 19 deletions

View File

@ -371,8 +371,10 @@ Attention! This branch will go EOL around February 2019.
And even more stable, although the 0.1a releases were
called "beta" up to now.
mars0.1stable69
* Major improvement: compatibility to upstream kernel 4.9.x.
mars0.1stable68
* Minor fix: detach could hang under very weird circumstances.
* Minor fix: in extremly rare cases and under further conditions,
detach could hang due to a race.
Workaround was possible by re-attaching.
@ -393,9 +395,6 @@ mars0.1stable68
fake-sync in front of it, and then they are explicitly stating
once again that they really want to force a defective system,
and that they really know the fact that it is defective.
* Minor improvement: propagate logical and physical
sector sizes from the underlying disk to the virtual
mars device.
* Minor improvement: additional warning when network connections
are interrupted (asymmetrically), such as by mis-configuration
of network interfaces / routing / firewall rules / etc.

View File

@ -664,23 +664,18 @@ static int aio_event_thread(void *data)
if (mref->ref_rw)
mf_dirty_append(output->mf, DIRTY_COMPLETED, mref->ref_pos + mref->ref_len);
/* Workaround for never implemented aio_fsync operation,
* see also upstream commit 723c038475b78edc9327eb952f95f9881cc9d7.
* FIXME: don't use aio anymore at all in the long-term future.
*/
if (output->brick->o_fdsync
&& err >= 0
&& mref->ref_rw != READ
&& !mref->ref_skip_sync
&& !mref_a->resubmit++) {
// workaround for non-implemented AIO FSYNC operation
if (output->mf &&
output->mf->mf_filp &&
output->mf->mf_filp->f_op &&
!output->mf->mf_filp->f_op->aio_fsync) {
mars_trace(mref, "aio_fsync");
_enqueue(other, mref_a, mref->ref_prio, true);
continue;
}
err = aio_submit(output, mref_a, true);
if (likely(err >= 0))
continue;
mars_trace(mref, "aio_fsync");
_enqueue(other, mref_a, mref->ref_prio, true);
continue;
}
_complete(output, mref_a, err);

View File

@ -50,6 +50,11 @@
#define HAS_BI_ERROR
#endif
/* adapt to 4e1b2d52a80d79296a5d899d73249748dea71a53 and many others */
#ifdef bio_op
#define HAS_NEW_BIO_OP
#endif
// end_remove_this
int bio_nr_requests = 1024;
@ -260,7 +265,9 @@ int make_bio(struct bio_brick *brick, void *data, int len, loff_t pos, struct bi
bio->bi_bdev = bdev;
bio->bi_private = private;
bio->bi_end_io = bio_callback;
#ifndef HAS_NEW_BIO_OP
bio->bi_rw = 0; // must be filled in later
#endif
status = result_len;
out:
@ -470,12 +477,26 @@ void _bio_ref_io(struct bio_output *output, struct mref_object *mref, bool cork)
#ifdef FAKE_IO
bio->bi_end_io(bio, 0);
#else
#ifdef HAS_NEW_BIO_OP
if (rw & 1) {
bio_set_op_attrs(bio, REQ_OP_WRITE,
mref->ref_skip_sync ? 0 : WRITE_SYNC);
} else {
bio_set_op_attrs(bio, REQ_OP_READ,
mref->ref_skip_sync ? 0 : READ_SYNC);
}
latency = TIME_STATS(
&timings[rw & 1],
submit_bio(bio)
);
#else
bio->bi_rw = rw;
latency = TIME_STATS(
&timings[rw & 1],
submit_bio(rw, bio)
);
#endif
#endif
threshold_check(&bio_submit_threshold, latency);

View File

@ -84,6 +84,11 @@
#define USE_MAX_PHYS_SEGMENTS 1
#endif
/* adapt to 4e1b2d52a80d79296a5d899d73249748dea71a53 and many others */
#ifdef bio_op
#define HAS_NEW_BIO_OP
#endif
// end_remove_this
///////////////////////// global tuning ////////////////////////
@ -377,7 +382,11 @@ void if_make_request(struct request_queue *q, struct bio *bio)
*/
const int rw = bio_data_dir(bio);
const int sectors = bio_sectors(bio);
// adapt to different kernel versions (TBD: improve)
// remove_this
/* Adapt to different kernel versions.
* This is a maintainance nightmare.
* Most is provisionary.
*/
#if defined(BIO_RW_RQ_MASK) || defined(BIO_FLUSH)
const bool ahead = bio_rw_flagged(bio, BIO_RW_AHEAD) && rw == READ;
const bool barrier = bio_rw_flagged(bio, BIO_RW_BARRIER);
@ -395,9 +404,21 @@ void if_make_request(struct request_queue *q, struct bio *bio)
const bool meta = _flagged(REQ_META);
const bool discard = _flagged(REQ_DISCARD);
const bool noidle = _flagged(REQ_THROTTLED);
#elif defined(HAS_NEW_BIO_OP)
// end_remove_this
#define _flagged(x) (bio->bi_opf & (x))
const bool ahead = _flagged(REQ_RAHEAD) && rw == READ;
const bool barrier = false;
const bool syncio = _flagged(REQ_SYNC);
const bool unplug = false;
const bool meta = _flagged(REQ_META);
const bool discard = bio_op(bio) == REQ_OP_DISCARD;
const bool noidle = _flagged(REQ_THROTTLED);
// remove_this
#else
#error Cannot decode the bio flags
#endif
// end_remove_this
const int prio = bio_prio(bio);
/* Transform into MARS flags

View File

@ -126,12 +126,19 @@ EXPORT_SYMBOL_GPL(mars_dent_meta);
#define __NEW_PATH_CREATE
#endif
#include <linux/fscache-cache.h>
#ifndef FSCACHE_OP_DEAD
/* since kernel 3.8 */
/* see b9d6ba94b875192ef5e2dab92d72beea33b83c3d */
#define __HAS_RETRY_ESTALE
#endif
/* 5955102c9984fa081b2d570cfac75c97eecf8f3b
*/
#ifndef FLOCK_VERIFY_READ /* detect kernel 4.5-rc1 via acc15575e */
#define HAS_INODE_LOCK_WRAPPERS
#endif
/* Hack because of 8bcb77fabd7cbabcad49f58750be8683febee92b
*/
static int __path_parent(const char *name, struct path *path, unsigned flags)
@ -197,13 +204,21 @@ retry:
.ia_mtime.tv_nsec = mtime->tv_nsec,
};
#ifdef HAS_INODE_LOCK_WRAPPERS
inode_lock(dentry->d_inode);
#else
mutex_lock(&dentry->d_inode->i_mutex);
#endif
#ifdef FL_DELEG
error = notify_change(dentry, &iattr, NULL);
#else
error = notify_change(dentry, &iattr);
#endif
#ifdef HAS_INODE_LOCK_WRAPPERS
inode_unlock(dentry->d_inode);
#else
mutex_unlock(&dentry->d_inode->i_mutex);
#endif
}
#ifdef __NEW_PATH_CREATE
done_path_create(&path, dentry);
@ -439,7 +454,11 @@ retry:
if (error)
goto exit1;
#endif
#ifdef HAS_INODE_LOCK_WRAPPERS
inode_lock_nested(dentry->d_inode, I_MUTEX_PARENT);
#else
mutex_lock_nested(&parent->d_inode->i_mutex, I_MUTEX_PARENT);
#endif
dentry = lookup_one_len(one, parent, strlen(one));
error = PTR_ERR(dentry);
@ -470,7 +489,11 @@ retry:
exit3:
dput(dentry);
exit2:
#ifdef HAS_INODE_LOCK_WRAPPERS
inode_unlock(dentry->d_inode);
#else
mutex_unlock(&parent->d_inode->i_mutex);
#endif
if (inode)
iput(inode);
#ifdef __NEW_PATH_CREATE
@ -2317,8 +2340,8 @@ struct mars_brick *make_brick_all(
const char *new_path;
char *_new_path = NULL;
struct mars_brick *brick = NULL;
char *paths[prev_count];
struct mars_brick *prev[prev_count];
char *paths[prev_count + 1];
struct mars_brick *prev[prev_count + 1];
bool switch_state;
int i;
int status;

View File

@ -0,0 +1,173 @@
From 26ba1ef09e957b17a87892b754a5717e19164776 Mon Sep 17 00:00:00 2001
From: Thomas Schoebel-Theuer <tst@1und1.de>
Date: Mon, 22 Aug 2016 12:54:44 +0200
Subject: [PATCH 1/2] mars: minimum pre-patch for mars
Mostly introduces some EXPORT_SYMBOL().
Should have almost no impact onto the kernel.
---
fs/aio.c | 5 +++++
fs/namei.c | 5 +++++
fs/open.c | 2 ++
fs/utimes.c | 2 ++
include/uapi/linux/major.h | 1 +
mm/page_alloc.c | 2 ++
6 files changed, 17 insertions(+)
diff --git a/fs/aio.c b/fs/aio.c
index b1170a7affe2..206c797f7f6e 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1382,6 +1382,7 @@ SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp)
out:
return ret;
}
+EXPORT_SYMBOL(sys_io_setup);
/* sys_io_destroy:
* Destroy the aio_context specified. May cancel any outstanding
@@ -1418,6 +1419,7 @@ SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx)
pr_debug("EINVAL: invalid context id\n");
return -EINVAL;
}
+EXPORT_SYMBOL(sys_io_destroy);
static int aio_setup_rw(int rw, struct iocb *iocb, struct iovec **iovec,
bool vectored, bool compat, struct iov_iter *iter)
@@ -1660,6 +1662,7 @@ long do_io_submit(aio_context_t ctx_id, long nr,
percpu_ref_put(&ctx->users);
return i ? i : ret;
}
+EXPORT_SYMBOL(sys_io_submit);
/* sys_io_submit:
* Queue the nr iocbs pointed to by iocbpp for processing. Returns
@@ -1749,6 +1752,7 @@ SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb,
return ret;
}
+EXPORT_SYMBOL(sys_io_cancel);
/* io_getevents:
* Attempts to read at least min_nr events and up to nr events from
@@ -1778,3 +1782,4 @@ SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
}
return ret;
}
+EXPORT_SYMBOL(sys_io_getevents);
diff --git a/fs/namei.c b/fs/namei.c
index 85ac38b99065..eaadb7cabde8 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3816,6 +3816,7 @@ SYSCALL_DEFINE2(mkdir, const char __user *, pathname, umode_t, mode)
{
return sys_mkdirat(AT_FDCWD, pathname, mode);
}
+EXPORT_SYMBOL(sys_mkdir);
int vfs_rmdir(struct inode *dir, struct dentry *dentry)
{
@@ -3919,6 +3920,7 @@ SYSCALL_DEFINE1(rmdir, const char __user *, pathname)
{
return do_rmdir(AT_FDCWD, pathname);
}
+EXPORT_SYMBOL(sys_rmdir);
/**
* vfs_unlink - unlink a filesystem object
@@ -4072,6 +4074,7 @@ SYSCALL_DEFINE1(unlink, const char __user *, pathname)
{
return do_unlinkat(AT_FDCWD, pathname);
}
+EXPORT_SYMBOL(sys_unlink);
int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
{
@@ -4129,6 +4132,7 @@ SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newn
{
return sys_symlinkat(oldname, AT_FDCWD, newname);
}
+EXPORT_SYMBOL(sys_symlink);
/**
* vfs_link - create a new link
@@ -4620,6 +4624,7 @@ SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newna
{
return sys_renameat2(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
}
+EXPORT_SYMBOL(sys_rename);
int vfs_whiteout(struct inode *dir, struct dentry *dentry)
{
diff --git a/fs/open.c b/fs/open.c
index a6c6244f4993..151ee4590d52 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -580,6 +580,7 @@ SYSCALL_DEFINE2(chmod, const char __user *, filename, umode_t, mode)
{
return sys_fchmodat(AT_FDCWD, filename, mode);
}
+EXPORT_SYMBOL(sys_chmod);
static int chown_common(const struct path *path, uid_t user, gid_t group)
{
@@ -665,6 +666,7 @@ SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group
return sys_fchownat(AT_FDCWD, filename, user, group,
AT_SYMLINK_NOFOLLOW);
}
+EXPORT_SYMBOL(sys_lchown);
SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
{
diff --git a/fs/utimes.c b/fs/utimes.c
index 22307cdf7014..c0164e967eb4 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -1,3 +1,4 @@
+#include <linux/module.h>
#include <linux/compiler.h>
#include <linux/file.h>
#include <linux/fs.h>
@@ -167,6 +168,7 @@ long do_utimes(int dfd, const char __user *filename, struct timespec *times,
out:
return error;
}
+EXPORT_SYMBOL(do_utimes);
SYSCALL_DEFINE4(utimensat, int, dfd, const char __user *, filename,
struct timespec __user *, utimes, int, flags)
diff --git a/include/uapi/linux/major.h b/include/uapi/linux/major.h
index 620252e69b44..61a665cdb420 100644
--- a/include/uapi/linux/major.h
+++ b/include/uapi/linux/major.h
@@ -148,6 +148,7 @@
#define UNIX98_PTY_SLAVE_MAJOR (UNIX98_PTY_MASTER_MAJOR+UNIX98_PTY_MAJOR_COUNT)
#define DRBD_MAJOR 147
+#define MARS_MAJOR 148
#define RTF_MAJOR 150
#define RAW_MAJOR 162
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 28240ce475d6..996405d80cd5 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -254,6 +254,7 @@ compound_page_dtor * const compound_page_dtors[] = {
};
int min_free_kbytes = 1024;
+EXPORT_SYMBOL(min_free_kbytes);
int user_min_free_kbytes = -1;
int watermark_scale_factor = 10;
@@ -6720,6 +6721,7 @@ static void __setup_per_zone_wmarks(void)
/* update totalreserve_pages */
calculate_totalreserve_pages();
}
+EXPORT_SYMBOL(setup_per_zone_wmarks);
/**
* setup_per_zone_wmarks - called when min_free_kbytes changes
--
2.19.0

View File

@ -0,0 +1,36 @@
From 929d37f94e29acd70366d437993f83444d547fbc Mon Sep 17 00:00:00 2001
From: Thomas Schoebel-Theuer <tst@1und1.de>
Date: Fri, 28 Jun 2013 11:03:14 +0200
Subject: [PATCH 2/2] mars: SPECIAL for in-tree build
---
block/Kconfig | 2 ++
block/Makefile | 2 ++
2 files changed, 4 insertions(+)
diff --git a/block/Kconfig b/block/Kconfig
index 1d4d624492fc..ad8961118fb2 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -118,6 +118,8 @@ source "block/partitions/Kconfig"
endmenu
+source block/mars/kernel/Kconfig
+
endif # BLOCK
config BLOCK_COMPAT
diff --git a/block/Makefile b/block/Makefile
index 36acdd7545be..c433d2b76a31 100644
--- a/block/Makefile
+++ b/block/Makefile
@@ -23,3 +23,5 @@ obj-$(CONFIG_BLOCK_COMPAT) += compat_ioctl.o
obj-$(CONFIG_BLK_CMDLINE_PARSER) += cmdline-parser.o
obj-$(CONFIG_BLK_DEV_INTEGRITY) += bio-integrity.o blk-integrity.o t10-pi.o
obj-$(CONFIG_BLK_MQ_PCI) += blk-mq-pci.o
+
+obj-$(CONFIG_MARS) += mars/kernel/
--
2.19.0