From: Janpieter Sollie <janpieter.sollie@kabelmail.de>
To: linux-bcachefs@vger.kernel.org
Subject: patch for upgrading to 5.11
Date: Tue, 2 Mar 2021 17:00:52 +0100 [thread overview]
Message-ID: <c3d2a014-f8ae-e0a5-9a9e-4b78f1e53f7b@kabelmail.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 413 bytes --]
This patch is a "hack", not a proper solution:
- It contains some things I'm not proud about (eg passing NULL to a function call)
- It contians things I'm not sure of (eg: does fopen need a exclusive lock n the device? or is
read/write sufficient?
Still, it allows me to patch to 5.11 kernel, and so far, everything is OK
Thank you Kent Overstreet for developing this FS!
Kind regards,
Janpieter Sollie
[-- Attachment #2: move_to_5.11.patch --]
[-- Type: text/x-patch, Size: 3112 bytes --]
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 2b6a300edf1d..1fa87def871e 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -1303,13 +1303,16 @@ static int bch2_sync_fs(struct super_block *sb, int wait)
return bch2_journal_flush(&c->journal);
}
-static struct bch_fs *bch2_path_to_fs(const char *dev)
+static struct bch_fs *bch2_path_to_fs(const char *devpath)
{
struct bch_fs *c;
- struct block_device *bdev = lookup_bdev(dev);
+ struct block_device *bdev;
+ dev_t dev;
+ int err = lookup_bdev(devpath, &dev);
+ bdev = blkdev_get_by_dev(dev, FMODE_READ | FMODE_WRITE, NULL);
- if (IS_ERR(bdev))
- return ERR_CAST(bdev);
+ if (err)
+ return ERR_PTR(-ENOENT);
c = bch2_bdev_to_fs(bdev);
bdput(bdev);
diff --git a/fs/bcachefs/str_hash.h b/fs/bcachefs/str_hash.h
index 9f0bd4405199..b07294df6a2d 100644
--- a/fs/bcachefs/str_hash.h
+++ b/fs/bcachefs/str_hash.h
@@ -12,7 +12,8 @@
#include <linux/crc32c.h>
#include <crypto/hash.h>
-#include <crypto/sha.h>
+#include <crypto/sha1.h>
+#include <crypto/sha2.h>
static inline enum bch_str_hash_type
bch2_str_hash_opt_to_type(struct bch_fs *c, enum bch_str_hash_opts opt)
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index eee7d6c011b6..663ed5e15c51 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -541,9 +541,8 @@ void __bch2_fs_stop(struct bch_fs *c)
for_each_member_device(ca, c, i)
if (ca->kobj.state_in_sysfs &&
ca->disk_sb.bdev)
- sysfs_remove_link(&part_to_dev(ca->disk_sb.bdev->bd_part)->kobj,
+ sysfs_remove_link(&(ca->disk_sb.bdev->bd_device.kobj),
"bcachefs");
-
if (c->kobj.state_in_sysfs)
kobject_del(&c->kobj);
@@ -1005,7 +1004,7 @@ static void bch2_dev_free(struct bch_dev *ca)
if (ca->kobj.state_in_sysfs &&
ca->disk_sb.bdev)
- sysfs_remove_link(&part_to_dev(ca->disk_sb.bdev->bd_part)->kobj,
+ sysfs_remove_link(&(ca->disk_sb.bdev->bd_device.kobj),
"bcachefs");
if (ca->kobj.state_in_sysfs)
@@ -1043,7 +1042,7 @@ static void __bch2_dev_offline(struct bch_fs *c, struct bch_dev *ca)
if (ca->kobj.state_in_sysfs) {
struct kobject *block =
- &part_to_dev(ca->disk_sb.bdev->bd_part)->kobj;
+ &(ca->disk_sb.bdev->bd_device.kobj);
sysfs_remove_link(block, "bcachefs");
sysfs_remove_link(&ca->kobj, "block");
@@ -1083,7 +1082,7 @@ static int bch2_dev_sysfs_online(struct bch_fs *c, struct bch_dev *ca)
if (ca->disk_sb.bdev) {
struct kobject *block =
- &part_to_dev(ca->disk_sb.bdev->bd_part)->kobj;
+ &(ca->disk_sb.bdev->bd_device.kobj);
ret = sysfs_create_link(block, &ca->kobj, "bcachefs");
if (ret)
@@ -1817,10 +1816,12 @@ int bch2_dev_resize(struct bch_fs *c, struct bch_dev *ca, u64 nbuckets)
/* return with ref on ca->ref: */
struct bch_dev *bch2_dev_lookup(struct bch_fs *c, const char *path)
{
- struct block_device *bdev = lookup_bdev(path);
+ struct block_device *bdev;
+ dev_t dev;
struct bch_dev *ca;
unsigned i;
-
+ int err = lookup_bdev(path, &dev);
+ bdev = blkdev_get_by_dev(dev, FMODE_READ | FMODE_WRITE, NULL);
if (IS_ERR(bdev))
return ERR_CAST(bdev);
reply other threads:[~2021-03-03 6:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=c3d2a014-f8ae-e0a5-9a9e-4b78f1e53f7b@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).