linux-bcachefs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Janpieter Sollie <janpieter.sollie@kabelmail.de>
To: linux-bcachefs@vger.kernel.org
Subject: [PATCH] adjustments for 5.8
Date: Sun, 16 Aug 2020 11:35:16 +0200	[thread overview]
Message-ID: <6dcb185b-807b-ded8-3fad-245ce9fd2e13@kabelmail.de> (raw)

Hi,


Hereby some patches for review of the implementation of v5.8

I explicitly included the KERNEL_VERSION header (which is probably not needed, since it's an
in-tree driver) as the current version is 5.7, so once the 5.8 bump has been applied, the
KERNEL_VERSION statement should be removed.


Janpieter


diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index a0d570f3adf0..cdc85423826c 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -7,6 +7,7 @@
 #include "btree_locking.h"
 #include "debug.h"
 
+#include <linux/version.h>
 #include <linux/prefetch.h>
 #include <linux/sched/mm.h>
 #include <trace/events/bcachefs.h>
@@ -85,8 +86,12 @@ static int btree_node_data_alloc(struct bch_fs *c, struct btree *b, gfp_t gfp)
        if (!b->data)
                return -ENOMEM;
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0))
        b->aux_data = __vmalloc(btree_aux_data_bytes(b), gfp,
                                PAGE_KERNEL_EXEC);
+#else
+       b->aux_data = __vmalloc(btree_aux_data_bytes(b), gfp);
+#endif
        if (!b->aux_data) {
                kvpfree(b->data, btree_bytes(c));
                b->data = NULL;
diff --git a/fs/bcachefs/btree_key_cache.c b/fs/bcachefs/btree_key_cache.c
index d73cc8ddadac..8b4bb75344ba 100644
--- a/fs/bcachefs/btree_key_cache.c
+++ b/fs/bcachefs/btree_key_cache.c
@@ -10,6 +10,7 @@
 #include "journal_reclaim.h"
 
 #include <trace/events/bcachefs.h>
+#include <linux/version.h>
 
 static int bch2_btree_key_cache_cmp_fn(struct rhashtable_compare_arg *arg,
                                       const void *obj)
@@ -391,7 +392,11 @@ static void btree_key_cache_journal_flush(struct journal *j,
        struct btree_trans trans;
 
        six_lock_read(&ck->c.lock, NULL, NULL);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0))
        key = READ_ONCE(ck->key);
+#else
+       key = __READ_ONCE(ck->key);
+#endif
 
        if (ck->journal.seq != seq ||
            !test_bit(BKEY_CACHED_DIRTY, &ck->flags)) {
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 951a436195ee..b4f73d9e74ea 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -20,11 +20,15 @@
 #include "quota.h"
 #include "reflink.h"
 
+#include <linux/version.h>
 #include <linux/aio.h>
 #include <linux/backing-dev.h>
 #include <linux/falloc.h>
 #include <linux/migrate.h>
 #include <linux/mmu_context.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
+#include <linux/kthread.h>
+#endif
 #include <linux/pagevec.h>
 #include <linux/sched/signal.h>
 #include <linux/task_io_accounting_ops.h>
@@ -1819,7 +1823,11 @@ static long bch2_dio_write_loop(struct dio_write *dio)
 
        while (1) {
                if (kthread)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0))
                        use_mm(dio->mm);
+#else
+                       kthread_use_mm(dio->mm);
+#endif
                BUG_ON(current->faults_disabled_mapping);
                current->faults_disabled_mapping = mapping;
 
@@ -1827,8 +1835,11 @@ static long bch2_dio_write_loop(struct dio_write *dio)
 
                current->faults_disabled_mapping = NULL;
                if (kthread)
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0))
                        unuse_mm(dio->mm);
-
+#else
+                       kthread_unuse_mm(dio->mm);
+#endif
                if (unlikely(ret < 0))
                        goto err;
 
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index a47923d67f7a..865619d0d2f0 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -22,6 +22,7 @@
 #include "super.h"
 #include "xattr.h"
 
+#include <linux/fiemap.h>
 #include <linux/aio.h>
 #include <linux/backing-dev.h>
 #include <linux/exportfs.h>
diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h
index 4dcd28456e00..4ae1d2a82ea6 100644
--- a/fs/bcachefs/util.h
+++ b/fs/bcachefs/util.h
@@ -2,6 +2,7 @@
 #ifndef _BCACHEFS_UTIL_H
 #define _BCACHEFS_UTIL_H
 
+#include <linux/version.h>
 #include <linux/bio.h>
 #include <linux/blkdev.h>
 #include <linux/closure.h>
@@ -99,7 +100,11 @@ static inline void *vpmalloc(size_t size, gfp_t gfp_mask)
 {
        return (void *) __get_free_pages(gfp_mask|__GFP_NOWARN,
                                         get_order(size)) ?:
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0))
                __vmalloc(size, gfp_mask, PAGE_KERNEL);
+#else
+               __vmalloc(size, gfp_mask);
+#endif
 }
 
 static inline void kvpfree(void *p, size_t size)


             reply	other threads:[~2020-08-16  9:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-16  9:35 Janpieter Sollie [this message]
2020-08-16  9:46 ` [PATCH][2/2] adjustments for 5.8 Janpieter Sollie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6dcb185b-807b-ded8-3fad-245ce9fd2e13@kabelmail.de \
    --to=janpieter.sollie@kabelmail.de \
    --cc=linux-bcachefs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).