mirror of
https://github.com/koverstreet/bcachefs-tools.git
synced 2025-01-23 00:07:07 +03:00
Update bcachefs sources to 5fd0c70102 bcachefs: Fix __remove_dirent()
This commit is contained in:
parent
9a649545a3
commit
42ba8b5a75
@ -1 +1 @@
|
||||
043cfba30c743a6faa4e53c5a88a259f8726ac01
|
||||
5fd0c701024d14d7e493780354a150d0e20cf0a6
|
||||
|
0
include/linux/backing-dev-defs.h
Normal file
0
include/linux/backing-dev-defs.h
Normal file
@ -21,6 +21,8 @@ struct request_queue {
|
||||
};
|
||||
|
||||
struct gendisk {
|
||||
struct backing_dev_info *bdi;
|
||||
struct backing_dev_info __bdi;
|
||||
};
|
||||
|
||||
struct hd_struct {
|
||||
@ -38,9 +40,6 @@ struct block_device {
|
||||
struct gendisk __bd_disk;
|
||||
int bd_fd;
|
||||
int bd_sync_fd;
|
||||
|
||||
struct backing_dev_info *bd_bdi;
|
||||
struct backing_dev_info __bd_bdi;
|
||||
};
|
||||
|
||||
#define bdev_kobj(_bdev) (&((_bdev)->kobj))
|
||||
|
@ -74,6 +74,17 @@ int blkdev_issue_discard(struct block_device *, sector_t,
|
||||
|
||||
#define bdev_get_queue(bdev) (&((bdev)->queue))
|
||||
|
||||
#ifndef SECTOR_SHIFT
|
||||
#define SECTOR_SHIFT 9
|
||||
#endif
|
||||
#ifndef SECTOR_SIZE
|
||||
#define SECTOR_SIZE (1 << SECTOR_SHIFT)
|
||||
#endif
|
||||
|
||||
#define PAGE_SECTORS_SHIFT (PAGE_SHIFT - SECTOR_SHIFT)
|
||||
#define PAGE_SECTORS (1 << PAGE_SECTORS_SHIFT)
|
||||
#define SECTOR_MASK (PAGE_SECTORS - 1)
|
||||
|
||||
#define blk_queue_discard(q) ((void) (q), 0)
|
||||
#define blk_queue_nonrot(q) ((void) (q), 0)
|
||||
|
||||
|
@ -78,4 +78,7 @@
|
||||
/********** security/ **********/
|
||||
#define KEY_DESTROY 0xbd
|
||||
|
||||
/********** net/core/page_pool.c **********/
|
||||
#define PP_SIGNATURE (0x40 + POISON_POINTER_DELTA)
|
||||
|
||||
#endif
|
||||
|
@ -212,7 +212,7 @@ bch2_acl_to_xattr(struct btree_trans *trans,
|
||||
return xattr;
|
||||
}
|
||||
|
||||
struct posix_acl *bch2_get_acl(struct inode *vinode, int type)
|
||||
struct posix_acl *bch2_get_acl(struct inode *vinode, int type, bool rcu)
|
||||
{
|
||||
struct bch_inode_info *inode = to_bch_ei(vinode);
|
||||
struct bch_fs *c = inode->v.i_sb->s_fs_info;
|
||||
@ -224,6 +224,9 @@ struct posix_acl *bch2_get_acl(struct inode *vinode, int type)
|
||||
struct bkey_s_c k;
|
||||
int ret;
|
||||
|
||||
if (rcu)
|
||||
return ERR_PTR(-ECHILD);
|
||||
|
||||
bch2_trans_init(&trans, c, 0, 0);
|
||||
retry:
|
||||
bch2_trans_begin(&trans);
|
||||
|
@ -26,7 +26,7 @@ typedef struct {
|
||||
__le32 a_version;
|
||||
} bch_acl_header;
|
||||
|
||||
struct posix_acl *bch2_get_acl(struct inode *, int);
|
||||
struct posix_acl *bch2_get_acl(struct inode *, int, bool);
|
||||
|
||||
int bch2_set_acl_trans(struct btree_trans *, subvol_inum,
|
||||
struct bch_inode_unpacked *,
|
||||
|
@ -1018,7 +1018,7 @@ void bch2_recalc_capacity(struct bch_fs *c)
|
||||
lockdep_assert_held(&c->state_lock);
|
||||
|
||||
for_each_online_member(ca, c, i) {
|
||||
struct backing_dev_info *bdi = ca->disk_sb.bdev->bd_bdi;
|
||||
struct backing_dev_info *bdi = ca->disk_sb.bdev->bd_disk->bdi;
|
||||
|
||||
ra_pages += bdi->ra_pages;
|
||||
}
|
||||
|
@ -179,6 +179,7 @@
|
||||
#undef pr_fmt
|
||||
#define pr_fmt(fmt) "bcachefs: %s() " fmt "\n", __func__
|
||||
|
||||
#include <linux/backing-dev-defs.h>
|
||||
#include <linux/bug.h>
|
||||
#include <linux/bio.h>
|
||||
#include <linux/closure.h>
|
||||
|
@ -175,8 +175,8 @@ bool __bch2_btree_node_relock(struct btree_trans *trans,
|
||||
}
|
||||
}
|
||||
|
||||
static bool bch2_btree_node_upgrade(struct btree_trans *trans,
|
||||
struct btree_path *path, unsigned level)
|
||||
bool bch2_btree_node_upgrade(struct btree_trans *trans,
|
||||
struct btree_path *path, unsigned level)
|
||||
{
|
||||
struct btree *b = path->l[level].b;
|
||||
|
||||
|
@ -166,6 +166,9 @@ static inline int btree_trans_restart(struct btree_trans *trans)
|
||||
return -EINTR;
|
||||
}
|
||||
|
||||
bool bch2_btree_node_upgrade(struct btree_trans *,
|
||||
struct btree_path *, unsigned);
|
||||
|
||||
bool __bch2_btree_path_upgrade(struct btree_trans *,
|
||||
struct btree_path *, unsigned);
|
||||
|
||||
|
@ -507,6 +507,15 @@ err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void path_upgrade_readers(struct btree_trans *trans, struct btree_path *path)
|
||||
{
|
||||
unsigned l;
|
||||
|
||||
for (l = 0; l < BTREE_MAX_DEPTH; l++)
|
||||
if (btree_node_read_locked(path, l))
|
||||
BUG_ON(!bch2_btree_node_upgrade(trans, path, l));
|
||||
}
|
||||
|
||||
static inline void upgrade_readers(struct btree_trans *trans, struct btree_path *path)
|
||||
{
|
||||
struct btree *b = path_l(path)->b;
|
||||
@ -514,7 +523,7 @@ static inline void upgrade_readers(struct btree_trans *trans, struct btree_path
|
||||
do {
|
||||
if (path->nodes_locked &&
|
||||
path->nodes_locked != path->nodes_intent_locked)
|
||||
BUG_ON(!bch2_btree_path_upgrade(trans, path, path->level + 1));
|
||||
path_upgrade_readers(trans, path);
|
||||
} while ((path = prev_btree_path(trans, path)) &&
|
||||
path_l(path)->b == b);
|
||||
}
|
||||
@ -560,7 +569,8 @@ static inline bool have_conflicting_read_lock(struct btree_trans *trans, struct
|
||||
//if (path == pos)
|
||||
// break;
|
||||
|
||||
if (path->nodes_locked != path->nodes_intent_locked)
|
||||
if (path->nodes_locked != path->nodes_intent_locked &&
|
||||
!bch2_btree_path_upgrade(trans, path, path->level + 1))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1509,8 +1509,8 @@ retry_reservation:
|
||||
unsigned pg_offset = (offset + copied) & (PAGE_SIZE - 1);
|
||||
unsigned pg_len = min_t(unsigned, len - copied,
|
||||
PAGE_SIZE - pg_offset);
|
||||
unsigned pg_copied = iov_iter_copy_from_user_atomic(page,
|
||||
iter, pg_offset, pg_len);
|
||||
unsigned pg_copied = copy_page_from_iter_atomic(page,
|
||||
pg_offset, pg_len,iter);
|
||||
|
||||
if (!pg_copied)
|
||||
break;
|
||||
@ -1523,7 +1523,6 @@ retry_reservation:
|
||||
}
|
||||
|
||||
flush_dcache_page(page);
|
||||
iov_iter_advance(iter, pg_copied);
|
||||
copied += pg_copied;
|
||||
|
||||
if (pg_copied != pg_len)
|
||||
|
@ -113,6 +113,35 @@ static int subvol_lookup(struct btree_trans *trans, u32 subvol,
|
||||
return lockrestart_do(trans, __subvol_lookup(trans, subvol, snapshot, inum));
|
||||
}
|
||||
|
||||
static int lookup_first_inode(struct btree_trans *trans, u64 inode_nr,
|
||||
struct bch_inode_unpacked *inode)
|
||||
{
|
||||
struct btree_iter iter;
|
||||
struct bkey_s_c k;
|
||||
int ret;
|
||||
|
||||
bch2_trans_iter_init(trans, &iter, BTREE_ID_inodes,
|
||||
POS(0, inode_nr),
|
||||
BTREE_ITER_ALL_SNAPSHOTS);
|
||||
k = bch2_btree_iter_peek(&iter);
|
||||
ret = bkey_err(k);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
if (!k.k || bkey_cmp(k.k->p, POS(0, inode_nr))) {
|
||||
ret = -ENOENT;
|
||||
goto err;
|
||||
}
|
||||
|
||||
ret = bch2_inode_unpack(bkey_s_c_to_inode(k), inode);
|
||||
err:
|
||||
if (ret && ret != -EINTR)
|
||||
bch_err(trans->c, "error %i fetching inode %llu",
|
||||
ret, inode_nr);
|
||||
bch2_trans_iter_exit(trans, &iter);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int __lookup_inode(struct btree_trans *trans, u64 inode_nr,
|
||||
struct bch_inode_unpacked *inode,
|
||||
u32 *snapshot)
|
||||
@ -272,7 +301,7 @@ static int __remove_dirent(struct btree_trans *trans, struct bpos pos)
|
||||
struct bch_hash_info dir_hash_info;
|
||||
int ret;
|
||||
|
||||
ret = __lookup_inode(trans, pos.inode, &dir_inode, NULL);
|
||||
ret = lookup_first_inode(trans, pos.inode, &dir_inode);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@ -669,7 +698,7 @@ static int check_key_has_snapshot(struct btree_trans *trans,
|
||||
char buf[200];
|
||||
int ret = 0;
|
||||
|
||||
if (fsck_err_on(!snapshot_t(c, k.k->p.snapshot)->equiv, c,
|
||||
if (mustfix_fsck_err_on(!snapshot_t(c, k.k->p.snapshot)->equiv, c,
|
||||
"key in missing snapshot: %s",
|
||||
(bch2_bkey_val_to_text(&PBUF(buf), c, k), buf)))
|
||||
return bch2_btree_delete_at(trans, iter,
|
||||
@ -918,8 +947,7 @@ static int check_inodes(struct bch_fs *c, bool full)
|
||||
|
||||
bch2_trans_init(&trans, c, BTREE_ITER_MAX, 0);
|
||||
|
||||
bch2_trans_iter_init(&trans, &iter, BTREE_ID_inodes,
|
||||
POS(BCACHEFS_ROOT_INO, 0),
|
||||
bch2_trans_iter_init(&trans, &iter, BTREE_ID_inodes, POS_MIN,
|
||||
BTREE_ITER_INTENT|
|
||||
BTREE_ITER_PREFETCH|
|
||||
BTREE_ITER_ALL_SNAPSHOTS);
|
||||
|
@ -807,7 +807,8 @@ int bch2_write_super(struct bch_fs *c)
|
||||
!can_mount_with_written ||
|
||||
(can_mount_without_written &&
|
||||
!can_mount_with_written), c,
|
||||
"Unable to write superblock to sufficient devices"))
|
||||
"Unable to write superblock to sufficient devices (from %ps)",
|
||||
(void *) _RET_IP_))
|
||||
ret = -1;
|
||||
out:
|
||||
/* Make new options visible after they're persistent: */
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
#define PAGE_SECTOR_SHIFT (PAGE_SHIFT - 9)
|
||||
#define PAGE_SECTORS (1UL << PAGE_SECTOR_SHIFT)
|
||||
|
||||
struct closure;
|
||||
|
||||
|
@ -205,8 +205,8 @@ struct block_device *blkdev_get_by_path(const char *path, fmode_t mode,
|
||||
bdev->bd_sync_fd = sync_fd;
|
||||
bdev->bd_holder = holder;
|
||||
bdev->bd_disk = &bdev->__bd_disk;
|
||||
bdev->bd_bdi = &bdev->__bd_bdi;
|
||||
bdev->queue.backing_dev_info = bdev->bd_bdi;
|
||||
bdev->bd_disk->bdi = &bdev->bd_disk->__bdi;
|
||||
bdev->queue.backing_dev_info = bdev->bd_disk->bdi;
|
||||
|
||||
return bdev;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user