mirror of
https://github.com/versity/scoutfs.git
synced 2026-04-30 09:56:55 +00:00
Compare commits
14 Commits
auke/rhel1
...
clk/srch-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5465350ba2 | ||
|
|
bf4f2ef8bb | ||
|
|
c5207243f0 | ||
|
|
8d330861ba | ||
|
|
b7beadb22c | ||
|
|
926bb6b9ec | ||
|
|
a420f5389e | ||
|
|
544362dfaa | ||
|
|
79593b6ecc | ||
|
|
b6e7d5b2d0 | ||
|
|
487d38a4a5 | ||
|
|
9cddf6d9c9 | ||
|
|
d81c318c3e | ||
|
|
279b093600 |
@@ -1,51 +1,6 @@
|
||||
Versity ScoutFS Release Notes
|
||||
=============================
|
||||
|
||||
---
|
||||
v1.28
|
||||
\
|
||||
*Feb 5, 2026*
|
||||
|
||||
Fix a bug that lead to incorrect negative caching of ACL entries
|
||||
starting in version 9.6 of distribution kernels in the enterprise linux
|
||||
family. This would manifest as ACLs seemingly disappearing,
|
||||
particularly default ACLs on directories. The persistent ACLs always
|
||||
existed but because of internal API incompatibility some readers
|
||||
couldn't see them and would cache that they didn't exist.
|
||||
|
||||
---
|
||||
v1.27
|
||||
\
|
||||
*Jan 15, 2026*
|
||||
|
||||
Switch away from using the general VM cache reclaim machinery to reduce
|
||||
idle cluster locks in the client. The VM treated locks like a cache and
|
||||
let many accumulate, presuming that it would be efficient to free them
|
||||
in batches. Lock freeing requires network communication so this could
|
||||
result in enormous backlogs in network messages (on the order of
|
||||
hundreds of thousands) and could result in signifcant delays of other
|
||||
network messaging.
|
||||
|
||||
Fix inefficient network receive processing while many messages are in
|
||||
the send queue. This consumed sufficient CPU to cause significant
|
||||
stalls, perhaps resulting in hung task warning messages due to delayed
|
||||
lock message delivery.
|
||||
|
||||
Fix a server livelock case that could happen while committing client
|
||||
transactions that contain a large amount of freed file data extents.
|
||||
This would present as client tasks hanging and a server task spinning
|
||||
consuming cpu.
|
||||
|
||||
Fix a rare server request processing failure that doesn't deal with
|
||||
retransmission of a request that a previous server partially processed.
|
||||
This would present as hung client tasks and repeated "error -2
|
||||
committing log merge: getting merge status item" kernel messages.
|
||||
|
||||
Fix an unneccessary server shutdown during specific circumstances in
|
||||
client lock recovery. The shutdown was due to server state and was
|
||||
ultimately harmless. The next server that started up would proceed
|
||||
accordingly.
|
||||
|
||||
---
|
||||
v1.26
|
||||
\
|
||||
|
||||
@@ -60,11 +60,11 @@ scoutfs-y += \
|
||||
#
|
||||
.PHONY: $(src)/check_exported_types
|
||||
$(src)/check_exported_types:
|
||||
@if grep -E '\<[us](8|16|32|64\>)' $(src)/format.h $(src)/ioctl.h; then \
|
||||
@if egrep '\<[us](8|16|32|64\>)' $(src)/format.h $(src)/ioctl.h; then \
|
||||
echo "no raw types in exported headers, preface with __"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@if grep -E '\<__packed\>' $(src)/format.h $(src)/ioctl.h; then \
|
||||
@if egrep '\<__packed\>' $(src)/format.h $(src)/ioctl.h; then \
|
||||
echo "no __packed allowed in exported headers"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
@@ -479,148 +479,10 @@ ifneq (,$(shell grep '^unsigned int stack_trace_save' include/linux/stacktrace.h
|
||||
ccflags-y += -DKC_STACK_TRACE_SAVE
|
||||
endif
|
||||
|
||||
# v6.1-rc1-4-g7420332a6ff4
|
||||
#
|
||||
# v6.1-rc1-2-g138060ba92b3
|
||||
#
|
||||
# set_acl now passed a struct dentry instead of inode.
|
||||
#
|
||||
ifneq (,$(shell grep 'int ..set_acl.*struct dentry' include/linux/fs.h))
|
||||
ccflags-y += -DKC_SET_ACL_DENTRY
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.1-rc1-3-gcac2f8b8d8b5
|
||||
#
|
||||
# get_acl renamed to get_inode_acl.
|
||||
#
|
||||
ifneq (,$(shell grep 'struct posix_acl.*get_inode_acl' include/linux/fs.h))
|
||||
ccflags-y += -DKC_GET_INODE_ACL
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.1-rc5-2-ge9a688bcb193
|
||||
#
|
||||
# get_random_u32_below() implementation
|
||||
ifneq (,$(shell grep 'u32 get_random_u32_below' include/linux/random.h))
|
||||
ccflags-y += -DKC_HAVE_GET_RANDOM_U32_BELOW
|
||||
endif
|
||||
|
||||
# v6.5-rc1-7-g9b6304c1d537
|
||||
#
|
||||
# ctime accessor methods
|
||||
ifneq (,$(shell grep 'timespec64 inode_set_ctime_current' include/linux/fs.h))
|
||||
ccflags-y += -DKC_FS_INODE_C_TIME_ACCESSOR
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.6-rc5-1-g077c212f0344
|
||||
#
|
||||
# Must use access methods from fs.h to get to inode ctime/mtime/atime
|
||||
ifneq (,$(shell grep 'inline time64_t inode_get_atime_sec' include/linux/fs.h))
|
||||
ccflags-y += -DKC_FS_INODE_AM_TIME_ACCESSOR
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.12-rc1-3-g5f60d5f6bbc1
|
||||
#
|
||||
# asm/unaligned.h replaced with linux/unaligned.h
|
||||
ifneq (,$(shell grep -s 'define __LINUX_UNALIGNED_H' include/linux/unaligned.h))
|
||||
ccflags-y += -DKC_HAVE__LINUX_UNALIGNED_H
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.9-rc4-29-g203c1ce0bb06
|
||||
#
|
||||
# RIP bd_inode. (note, struct moved between headers!)
|
||||
ifneq (,$(shell grep -s 'struct inode.*bd_inode' include/linux/blk_types.h include/linux/fs.h))
|
||||
ccflags-y += -DKC_HAVE_BD_INODE
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.8-9146-gc759e609030c
|
||||
#
|
||||
# Removes __assign_str_len() and removes the 2nd param of __assign_str().
|
||||
ifneq (,$(shell grep -s 'define __assign_str.dst, src' \
|
||||
include/trace/trace_events.h \
|
||||
include/trace/ftrace.h \
|
||||
include/trace/stages/stage6_event_callback.h))
|
||||
ccflags-y += -DKC_HAVE_ASSIGN_STR_PARMS
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.5-113-g615e95831ec3
|
||||
#
|
||||
ifneq (,$(shell grep 'generic_fillattr..*,.u32,' include/linux/fs.h))
|
||||
ccflags-y += -DKC_GENERIC_FILLATTR_REQUEST_MASK
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.6-rc4-53-gc42d50aefd17
|
||||
#
|
||||
# el10 yet again modifies the shrinker API significantly, breaking our current
|
||||
# implementation.
|
||||
ifneq (,$(shell grep 'struct shrinker .shrinker_alloc' include/linux/shrinker.h))
|
||||
ccflags-y += -DKC_SHRINKER_ALLOC
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.9-rc4-8-gead083aeeed9
|
||||
#
|
||||
# set_blocksize() now has a struct file arg.
|
||||
ifneq (,$(shell grep -s 'int set_blocksize.struct file' include/linux/blkdev.h))
|
||||
ccflags-y += -DKC_BLKDEV_SET_BLOCKSIZE_FILE
|
||||
endif
|
||||
|
||||
#
|
||||
# v5.1-rc3-29-gaa30f47cf666
|
||||
#
|
||||
# struct kobj_type now has member `default_groups`
|
||||
ifneq (,$(shell grep 'const struct attribute_group ..default_groups;' include/linux/kobject.h))
|
||||
ccflags-y += -DKC_KOBJECT_DEFAULT_GROUPS
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.7-rc4-307-g17bf23a981be
|
||||
#
|
||||
# block_write_full_page() is replaced with block_write_full_folio(),
|
||||
# but that isn't exported as it used to be (and the only users now
|
||||
# are builtin). However, the kernel will fall back to using the
|
||||
# .writepages method instead, so we can drop this method.
|
||||
ifneq (,$(shell grep 'int block_write_full_page.struct page' include/linux/buffer_head.h))
|
||||
ccflags-y += -DKC_HAVE_BLOCK_WRITE_FULL_PAGE
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.4-rc2-29-gc6585011bc1d
|
||||
#
|
||||
# generic_file_splice_read is removed. It can be replaced with filemap_splice_read
|
||||
# or copy_splice_read.
|
||||
ifneq (,$(shell grep 'ssize_t generic_file_splice_read.struct file' include/linux/fs.h))
|
||||
ccflags-y += -DKC_HAVE_GENERIC_FILE_SPLICE_READ
|
||||
endif
|
||||
|
||||
#
|
||||
# v5.19-rc3-395-g67235182a41c
|
||||
#
|
||||
# Adds buffer_migrate_folio(), similar to other fss. Quote willy: "If the filesystem
|
||||
# implements migrate_folio and writepages, there is no need for a writepage implementation."
|
||||
ifneq (,$(shell grep 'int buffer_migrate_folio.struct address_space' include/linux/buffer_head.h))
|
||||
ccflags-y += -DKC_HAVE_BUFFER_MIGRATE_FOLIO
|
||||
endif
|
||||
|
||||
#
|
||||
# v4.6-rc3-29-g6192269444eb
|
||||
#
|
||||
# Adds .iterate_shared readdir() iterator vfs method.
|
||||
ifneq (,$(shell grep 'iterate_shared...struct file.., struct dir_context' include/linux/fs.h))
|
||||
ccflags-y += -DKC_HAVE_ITERATE_SHARED
|
||||
endif
|
||||
|
||||
#
|
||||
# v6.11-rc1-54-g9f04609f74ec
|
||||
#
|
||||
# Last of a series of changes that make block_write_begin/end take a folio instead of
|
||||
# a struct pagep.
|
||||
ifneq (,$(shell grep 'int __block_write_begin.struct.folio' include/linux/buffer_head.h))
|
||||
ccflags-y += -DKC_BLOCK_WRITE_BEGIN_FOLIO
|
||||
# .get_acl() method now has dentry arg (and mnt_idmap). The old get_acl has been renamed
|
||||
# to get_inode_acl() and is still available as well, but has an extra rcu param.
|
||||
ifneq (,$(shell grep 'struct posix_acl ...get_acl..struct mnt_idmap ., struct dentry' include/linux/fs.h))
|
||||
ccflags-y += -DKC_GET_ACL_DENTRY
|
||||
endif
|
||||
|
||||
@@ -107,22 +107,20 @@ struct posix_acl *scoutfs_get_acl_locked(struct inode *inode, int type, struct s
|
||||
return acl;
|
||||
}
|
||||
|
||||
#ifdef KC_GET_INODE_ACL
|
||||
struct posix_acl *scoutfs_get_acl(struct inode *inode, int type, bool rcu)
|
||||
#ifdef KC_GET_ACL_DENTRY
|
||||
struct posix_acl *scoutfs_get_acl(KC_VFS_NS_DEF
|
||||
struct dentry *dentry, int type)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
#else
|
||||
struct posix_acl *scoutfs_get_acl(struct inode *inode, int type)
|
||||
#endif
|
||||
{
|
||||
#endif
|
||||
struct super_block *sb = inode->i_sb;
|
||||
struct scoutfs_lock *lock = NULL;
|
||||
struct posix_acl *acl;
|
||||
int ret;
|
||||
|
||||
#ifdef KC_GET_INODE_ACL
|
||||
if (rcu)
|
||||
return ERR_PTR(-ECHILD);
|
||||
#endif
|
||||
|
||||
#ifndef KC___POSIX_ACL_CREATE
|
||||
if (!IS_POSIXACL(inode))
|
||||
return NULL;
|
||||
@@ -197,7 +195,7 @@ int scoutfs_set_acl_locked(struct inode *inode, struct posix_acl *acl, int type,
|
||||
if (!value) {
|
||||
/* can be setting an acl that only affects mode, didn't need xattr */
|
||||
inode_inc_iversion(inode);
|
||||
inode_set_ctime_current(inode);
|
||||
inode->i_ctime = current_time(inode);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +208,7 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef KC_SET_ACL_DENTRY
|
||||
#ifdef KC_GET_ACL_DENTRY
|
||||
int scoutfs_set_acl(KC_VFS_NS_DEF
|
||||
struct dentry *dentry, struct posix_acl *acl, int type)
|
||||
{
|
||||
@@ -256,8 +254,9 @@ int scoutfs_acl_get_xattr(struct dentry *dentry, const char *name, void *value,
|
||||
if (!IS_POSIXACL(dentry->d_inode))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
#ifdef KC_GET_INODE_ACL
|
||||
acl = scoutfs_get_acl(dentry->d_inode, type, false);
|
||||
#ifdef KC_GET_ACL_DENTRY
|
||||
acl = scoutfs_get_acl(KC_VFS_INIT_NS
|
||||
dentry, type);
|
||||
#else
|
||||
acl = scoutfs_get_acl(dentry->d_inode, type);
|
||||
#endif
|
||||
@@ -306,7 +305,7 @@ int scoutfs_acl_set_xattr(struct dentry *dentry, const char *name, const void *v
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef KC_SET_ACL_DENTRY
|
||||
#ifdef KC_GET_ACL_DENTRY
|
||||
ret = scoutfs_set_acl(KC_VFS_INIT_NS dentry, acl, type);
|
||||
#else
|
||||
ret = scoutfs_set_acl(dentry->d_inode, acl, type);
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
#ifndef _SCOUTFS_ACL_H_
|
||||
#define _SCOUTFS_ACL_H_
|
||||
|
||||
#ifdef KC_SET_ACL_DENTRY
|
||||
int scoutfs_set_acl(KC_VFS_NS_DEF
|
||||
struct dentry *dentry, struct posix_acl *acl, int type);
|
||||
#else
|
||||
int scoutfs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
|
||||
#endif
|
||||
#ifdef KC_GET_INODE_ACL
|
||||
struct posix_acl *scoutfs_get_acl(struct inode *inode, int type, bool rcu);
|
||||
#ifdef KC_GET_ACL_DENTRY
|
||||
struct posix_acl *scoutfs_get_acl(KC_VFS_NS_DEF struct dentry *dentry, int type);
|
||||
int scoutfs_set_acl(KC_VFS_NS_DEF struct dentry *dentry, struct posix_acl *acl, int type);
|
||||
#else
|
||||
struct posix_acl *scoutfs_get_acl(struct inode *inode, int type);
|
||||
int scoutfs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
|
||||
#endif
|
||||
struct posix_acl *scoutfs_get_acl_locked(struct inode *inode, int type, struct scoutfs_lock *lock);
|
||||
int scoutfs_set_acl_locked(struct inode *inode, struct posix_acl *acl, int type,
|
||||
|
||||
@@ -308,14 +308,14 @@ static bool invalid_extent(u64 start, u64 end, u64 first, u64 last)
|
||||
static bool invalid_meta_blkno(struct super_block *sb, u64 blkno)
|
||||
{
|
||||
struct scoutfs_sb_info *sbi = SCOUTFS_SB(sb);
|
||||
u64 last_meta = (i_size_read(KC_BDEV_INODE(sbi->meta_bdev)) >> SCOUTFS_BLOCK_LG_SHIFT) - 1;
|
||||
u64 last_meta = (i_size_read(sbi->meta_bdev->bd_inode) >> SCOUTFS_BLOCK_LG_SHIFT) - 1;
|
||||
|
||||
return invalid_extent(blkno, blkno, SCOUTFS_META_DEV_START_BLKNO, last_meta);
|
||||
}
|
||||
|
||||
static bool invalid_data_extent(struct super_block *sb, u64 start, u64 len)
|
||||
{
|
||||
u64 last_data = (i_size_read(KC_BDEV_INODE(sb->s_bdev)) >> SCOUTFS_BLOCK_SM_SHIFT) - 1;
|
||||
u64 last_data = (i_size_read(sb->s_bdev->bd_inode) >> SCOUTFS_BLOCK_SM_SHIFT) - 1;
|
||||
|
||||
return invalid_extent(start, start + len - 1, SCOUTFS_DATA_DEV_START_BLKNO, last_data);
|
||||
}
|
||||
|
||||
@@ -103,8 +103,8 @@ int scoutfs_get_attr_x(struct inode *inode, struct scoutfs_ioctl_inode_attr_x *i
|
||||
size = fill_attr(size, iax, SCOUTFS_IOC_IAX_OFFLINE_BLOCKS,
|
||||
offline_blocks, offline);
|
||||
}
|
||||
size = fill_attr(size, iax, SCOUTFS_IOC_IAX_CTIME, ctime_sec, inode_get_ctime_sec(inode));
|
||||
size = fill_attr(size, iax, SCOUTFS_IOC_IAX_CTIME, ctime_nsec, inode_get_ctime_nsec(inode));
|
||||
size = fill_attr(size, iax, SCOUTFS_IOC_IAX_CTIME, ctime_sec, inode->i_ctime.tv_sec);
|
||||
size = fill_attr(size, iax, SCOUTFS_IOC_IAX_CTIME, ctime_nsec, inode->i_ctime.tv_nsec);
|
||||
size = fill_attr(size, iax, SCOUTFS_IOC_IAX_CRTIME, crtime_sec, si->crtime.tv_sec);
|
||||
size = fill_attr(size, iax, SCOUTFS_IOC_IAX_CRTIME, crtime_nsec, si->crtime.tv_nsec);
|
||||
size = fill_attr(size, iax, SCOUTFS_IOC_IAX_SIZE, size, i_size_read(inode));
|
||||
@@ -223,8 +223,10 @@ int scoutfs_set_attr_x(struct inode *inode, struct scoutfs_ioctl_inode_attr_x *i
|
||||
scoutfs_inode_set_data_version(inode, iax->data_version);
|
||||
if (iax->x_mask & SCOUTFS_IOC_IAX_SIZE)
|
||||
i_size_write(inode, iax->size);
|
||||
if (iax->x_mask & SCOUTFS_IOC_IAX_CTIME)
|
||||
inode_set_ctime(inode, iax->ctime_sec, iax->ctime_nsec);
|
||||
if (iax->x_mask & SCOUTFS_IOC_IAX_CTIME) {
|
||||
inode->i_ctime.tv_sec = iax->ctime_sec;
|
||||
inode->i_ctime.tv_nsec = iax->ctime_nsec;
|
||||
}
|
||||
if (iax->x_mask & SCOUTFS_IOC_IAX_CRTIME) {
|
||||
si->crtime.tv_sec = iax->crtime_sec;
|
||||
si->crtime.tv_nsec = iax->crtime_nsec;
|
||||
|
||||
@@ -884,7 +884,7 @@ int scoutfs_block_dirty_ref(struct super_block *sb, struct scoutfs_alloc *alloc,
|
||||
hdr->magic = cpu_to_le32(magic);
|
||||
hdr->fsid = cpu_to_le64(sbi->fsid);
|
||||
hdr->blkno = cpu_to_le64(bl->blkno);
|
||||
get_random_bytes(&hdr->seq, sizeof(hdr->seq));
|
||||
prandom_bytes(&hdr->seq, sizeof(hdr->seq));
|
||||
|
||||
trace_scoutfs_block_dirty_ref(sb, le64_to_cpu(ref->blkno), le64_to_cpu(ref->seq),
|
||||
le64_to_cpu(hdr->blkno), le64_to_cpu(hdr->seq));
|
||||
@@ -1229,12 +1229,7 @@ static int sm_block_io(struct super_block *sb, struct block_device *bdev, blk_op
|
||||
kc_bio_set_sector(bio, blkno << (SCOUTFS_BLOCK_SM_SHIFT - 9));
|
||||
bio->bi_end_io = sm_block_bio_end_io;
|
||||
bio->bi_private = &sbc;
|
||||
ret = bio_add_page(bio, page, SCOUTFS_BLOCK_SM_SIZE, 0);
|
||||
if (ret != SCOUTFS_BLOCK_SM_SIZE) {
|
||||
bio_put(bio);
|
||||
ret = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
bio_add_page(bio, page, SCOUTFS_BLOCK_SM_SIZE, 0);
|
||||
|
||||
init_completion(&sbc.comp);
|
||||
sbc.err = 0;
|
||||
@@ -1290,12 +1285,9 @@ int scoutfs_block_setup(struct super_block *sb)
|
||||
|
||||
binf->sb = sb;
|
||||
init_waitqueue_head(&binf->waitq);
|
||||
KC_SETUP_SHRINKER(binf->shrinker, binf, 0, block_count_objects,
|
||||
block_scan_objects, "scoutfs-block:" SCSBF, SCSB_ARGS(sb));
|
||||
if (KC_SHRINKER_IS_NULL(binf->shrinker)) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
KC_INIT_SHRINKER_FUNCS(&binf->shrinker, block_count_objects,
|
||||
block_scan_objects);
|
||||
KC_REGISTER_SHRINKER(&binf->shrinker, "scoutfs-block:" SCSBF, SCSB_ARGS(sb));
|
||||
INIT_WORK(&binf->free_work, block_free_work);
|
||||
init_llist_head(&binf->free_llist);
|
||||
|
||||
@@ -1317,7 +1309,7 @@ void scoutfs_block_destroy(struct super_block *sb)
|
||||
struct block_info *binf = SCOUTFS_SB(sb)->block_info;
|
||||
|
||||
if (binf) {
|
||||
KC_UNREGISTER_SHRINKER(binf->shrinker);
|
||||
KC_UNREGISTER_SHRINKER(&binf->shrinker);
|
||||
block_shrink_all(sb);
|
||||
flush_work(&binf->free_work);
|
||||
rhashtable_destroy(&binf->ht);
|
||||
|
||||
@@ -2042,7 +2042,7 @@ struct merged_item {
|
||||
u64 seq;
|
||||
u8 flags;
|
||||
unsigned int val_len;
|
||||
u8 val[];
|
||||
u8 val[0];
|
||||
};
|
||||
|
||||
static inline struct merged_item *mitem_container(struct rb_node *node)
|
||||
@@ -2208,7 +2208,7 @@ static int merge_read_item(struct super_block *sb, struct scoutfs_key *key, u64
|
||||
mitem->flags = flags;
|
||||
mitem->val_len = val_len;
|
||||
if (val_len)
|
||||
memcpy(&mitem->val[0], val, val_len);
|
||||
memcpy(mitem->val, val, val_len);
|
||||
|
||||
if (found) {
|
||||
replace_mitem(rng, found, mitem);
|
||||
|
||||
@@ -30,7 +30,7 @@ struct scoutfs_btree_item_list {
|
||||
u64 seq;
|
||||
u8 flags;
|
||||
int val_len;
|
||||
u8 val[];
|
||||
u8 val[0];
|
||||
};
|
||||
|
||||
int scoutfs_btree_lookup(struct super_block *sb,
|
||||
|
||||
@@ -34,17 +34,6 @@ static struct attribute scoutfs_counter_attrs[] = {
|
||||
#define NR_ATTRS ARRAY_SIZE(scoutfs_counter_attrs)
|
||||
static struct attribute *scoutfs_counter_attr_ptrs[NR_ATTRS + 1];
|
||||
|
||||
#ifdef KC_KOBJECT_DEFAULT_GROUPS
|
||||
static struct attribute_group scoutfs_counter_attr_group = {
|
||||
.attrs = scoutfs_counter_attr_ptrs,
|
||||
};
|
||||
|
||||
static const struct attribute_group *scoutfs_counter_attr_groups[] = {
|
||||
&scoutfs_counter_attr_group,
|
||||
NULL,
|
||||
};
|
||||
#endif
|
||||
|
||||
static ssize_t scoutfs_counter_attr_show(struct kobject *kobj,
|
||||
struct attribute *attr, char *buf)
|
||||
{
|
||||
@@ -56,6 +45,7 @@ static ssize_t scoutfs_counter_attr_show(struct kobject *kobj,
|
||||
counters = container_of(kobj, struct scoutfs_counters, kobj);
|
||||
index = attr - scoutfs_counter_attrs;
|
||||
pcpu = &counters->FIRST_COUNTER + index;
|
||||
|
||||
return snprintf(buf, PAGE_SIZE, "%lld\n", percpu_counter_sum(pcpu));
|
||||
}
|
||||
|
||||
@@ -73,7 +63,7 @@ static const struct sysfs_ops scoutfs_counter_attr_ops = {
|
||||
};
|
||||
|
||||
static struct kobj_type scoutfs_counters_ktype = {
|
||||
.KC_KOBJ_DEFAULT_OP = KC_KOBJ_DEFAULT_PICK(scoutfs_counter_attr_groups, scoutfs_counter_attr_ptrs),
|
||||
.default_attrs = scoutfs_counter_attr_ptrs,
|
||||
.sysfs_ops = &scoutfs_counter_attr_ops,
|
||||
.release = scoutfs_counters_kobj_release,
|
||||
};
|
||||
|
||||
113
kmod/src/data.c
113
kmod/src/data.c
@@ -716,24 +716,24 @@ static int scoutfs_readpage(struct file *file, struct page *page)
|
||||
return ret;
|
||||
}
|
||||
|
||||
scoutfs_per_task_add_excl(&si->pt_data_lock, &pt_ent, inode_lock);
|
||||
|
||||
ret = scoutfs_data_wait_check(inode, page_offset(page),
|
||||
PAGE_SIZE, SEF_OFFLINE,
|
||||
SCOUTFS_IOC_DWO_READ, &dw,
|
||||
inode_lock);
|
||||
if (ret != 0) {
|
||||
unlock_page(page);
|
||||
scoutfs_per_task_del(&si->pt_data_lock, &pt_ent);
|
||||
scoutfs_unlock(sb, inode_lock, SCOUTFS_LOCK_READ);
|
||||
if (scoutfs_per_task_add_excl(&si->pt_data_lock, &pt_ent, inode_lock)) {
|
||||
ret = scoutfs_data_wait_check(inode, page_offset(page),
|
||||
PAGE_SIZE, SEF_OFFLINE,
|
||||
SCOUTFS_IOC_DWO_READ, &dw,
|
||||
inode_lock);
|
||||
if (ret != 0) {
|
||||
unlock_page(page);
|
||||
scoutfs_per_task_del(&si->pt_data_lock, &pt_ent);
|
||||
scoutfs_unlock(sb, inode_lock, SCOUTFS_LOCK_READ);
|
||||
}
|
||||
if (ret > 0) {
|
||||
ret = scoutfs_data_wait(inode, &dw);
|
||||
if (ret == 0)
|
||||
ret = AOP_TRUNCATED_PAGE;
|
||||
}
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
}
|
||||
if (ret > 0) {
|
||||
ret = scoutfs_data_wait(inode, &dw);
|
||||
if (ret == 0)
|
||||
ret = AOP_TRUNCATED_PAGE;
|
||||
}
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
#ifdef KC_MPAGE_READ_FOLIO
|
||||
ret = mpage_read_folio(folio, scoutfs_get_block_read);
|
||||
@@ -741,8 +741,8 @@ static int scoutfs_readpage(struct file *file, struct page *page)
|
||||
ret = mpage_readpage(page, scoutfs_get_block_read);
|
||||
#endif
|
||||
|
||||
scoutfs_per_task_del(&si->pt_data_lock, &pt_ent);
|
||||
scoutfs_unlock(sb, inode_lock, SCOUTFS_LOCK_READ);
|
||||
scoutfs_per_task_del(&si->pt_data_lock, &pt_ent);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -760,10 +760,8 @@ static int scoutfs_readpages(struct file *file, struct address_space *mapping,
|
||||
struct list_head *pages, unsigned nr_pages)
|
||||
{
|
||||
struct inode *inode = file->f_inode;
|
||||
struct scoutfs_inode_info *si = SCOUTFS_I(inode);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
struct scoutfs_lock *inode_lock = NULL;
|
||||
SCOUTFS_DECLARE_PER_TASK_ENTRY(pt_ent);
|
||||
struct page *page;
|
||||
struct page *tmp;
|
||||
int ret;
|
||||
@@ -773,8 +771,6 @@ static int scoutfs_readpages(struct file *file, struct address_space *mapping,
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
scoutfs_per_task_add_excl(&si->pt_data_lock, &pt_ent, inode_lock);
|
||||
|
||||
list_for_each_entry_safe(page, tmp, pages, lru) {
|
||||
ret = scoutfs_data_wait_check(inode, page_offset(page),
|
||||
PAGE_SIZE, SEF_OFFLINE,
|
||||
@@ -794,7 +790,6 @@ static int scoutfs_readpages(struct file *file, struct address_space *mapping,
|
||||
|
||||
ret = mpage_readpages(mapping, pages, nr_pages, scoutfs_get_block_read);
|
||||
out:
|
||||
scoutfs_per_task_del(&si->pt_data_lock, &pt_ent);
|
||||
scoutfs_unlock(sb, inode_lock, SCOUTFS_LOCK_READ);
|
||||
BUG_ON(!list_empty(pages));
|
||||
return ret;
|
||||
@@ -803,10 +798,8 @@ out:
|
||||
static void scoutfs_readahead(struct readahead_control *rac)
|
||||
{
|
||||
struct inode *inode = rac->file->f_inode;
|
||||
struct scoutfs_inode_info *si = SCOUTFS_I(inode);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
struct scoutfs_lock *inode_lock = NULL;
|
||||
SCOUTFS_DECLARE_PER_TASK_ENTRY(pt_ent);
|
||||
int ret;
|
||||
|
||||
ret = scoutfs_lock_inode(sb, SCOUTFS_LOCK_READ,
|
||||
@@ -814,8 +807,6 @@ static void scoutfs_readahead(struct readahead_control *rac)
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
scoutfs_per_task_add_excl(&si->pt_data_lock, &pt_ent, inode_lock);
|
||||
|
||||
ret = scoutfs_data_wait_check(inode, readahead_pos(rac),
|
||||
readahead_length(rac), SEF_OFFLINE,
|
||||
SCOUTFS_IOC_DWO_READ, NULL,
|
||||
@@ -823,17 +814,14 @@ static void scoutfs_readahead(struct readahead_control *rac)
|
||||
if (ret == 0)
|
||||
mpage_readahead(rac, scoutfs_get_block_read);
|
||||
|
||||
scoutfs_per_task_del(&si->pt_data_lock, &pt_ent);
|
||||
scoutfs_unlock(sb, inode_lock, SCOUTFS_LOCK_READ);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef KC_HAVE_BLOCK_WRITE_FULL_PAGE
|
||||
static int scoutfs_writepage(struct page *page, struct writeback_control *wbc)
|
||||
{
|
||||
return block_write_full_page(page, scoutfs_get_block_write, wbc);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int scoutfs_writepages(struct address_space *mapping,
|
||||
struct writeback_control *wbc)
|
||||
@@ -853,7 +841,7 @@ static int scoutfs_write_begin(struct file *file,
|
||||
#ifdef KC_BLOCK_WRITE_BEGIN_AOP_FLAGS
|
||||
unsigned flags,
|
||||
#endif
|
||||
KC_PAGE_OR_FOLIO(struct page **pagep, struct folio **folio), void **fsdata)
|
||||
struct page **pagep, void **fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
struct scoutfs_inode_info *si = SCOUTFS_I(inode);
|
||||
@@ -898,7 +886,7 @@ retry:
|
||||
#ifdef KC_BLOCK_WRITE_BEGIN_AOP_FLAGS
|
||||
flags,
|
||||
#endif
|
||||
KC_PAGE_OR_FOLIO(pagep, folio), scoutfs_get_block_write);
|
||||
pagep, scoutfs_get_block_write);
|
||||
if (ret < 0) {
|
||||
scoutfs_release_trans(sb);
|
||||
scoutfs_inode_index_unlock(sb, &wbd->ind_locks);
|
||||
@@ -931,8 +919,7 @@ static int writepages_sync_none(struct address_space *mapping, loff_t start,
|
||||
|
||||
static int scoutfs_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
KC_PAGE_OR_FOLIO(struct page *pagep, struct folio *folio),
|
||||
void *fsdata)
|
||||
struct page *page, void *fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
struct scoutfs_inode_info *si = SCOUTFS_I(inode);
|
||||
@@ -940,11 +927,10 @@ static int scoutfs_write_end(struct file *file, struct address_space *mapping,
|
||||
struct write_begin_data *wbd = fsdata;
|
||||
int ret;
|
||||
|
||||
trace_scoutfs_write_end(sb, scoutfs_ino(inode),
|
||||
KC_PAGE_OR_FOLIO(pagep->index, folio_index(folio)),
|
||||
(u64)pos, len, copied);
|
||||
trace_scoutfs_write_end(sb, scoutfs_ino(inode), page->index, (u64)pos,
|
||||
len, copied);
|
||||
|
||||
ret = generic_write_end(file, mapping, pos, len, copied, KC_PAGE_OR_FOLIO(pagep, folio), fsdata);
|
||||
ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
|
||||
if (ret > 0) {
|
||||
if (!si->staging) {
|
||||
scoutfs_inode_set_data_seq(inode);
|
||||
@@ -1497,14 +1483,12 @@ int scoutfs_data_move_blocks(struct inode *from, u64 from_off,
|
||||
|
||||
cur_time = current_time(from);
|
||||
if (!is_stage) {
|
||||
inode_set_ctime_to_ts(to, cur_time);
|
||||
inode_set_mtime_to_ts(to, cur_time);
|
||||
to->i_ctime = to->i_mtime = cur_time;
|
||||
inode_inc_iversion(to);
|
||||
scoutfs_inode_inc_data_version(to);
|
||||
scoutfs_inode_set_data_seq(to);
|
||||
}
|
||||
inode_set_ctime_to_ts(from, cur_time);
|
||||
inode_set_mtime_to_ts(from, cur_time);
|
||||
from->i_ctime = from->i_mtime = cur_time;
|
||||
inode_inc_iversion(from);
|
||||
scoutfs_inode_inc_data_version(from);
|
||||
scoutfs_inode_set_data_seq(from);
|
||||
@@ -1983,11 +1967,7 @@ static int scoutfs_data_page_mkwrite(struct vm_area_struct *vma,
|
||||
struct vm_fault *vmf)
|
||||
{
|
||||
#endif
|
||||
#ifdef KC_MPAGE_READ_FOLIO
|
||||
struct folio *folio = page_folio(vmf->page);
|
||||
#else
|
||||
struct page *page = vmf->page;
|
||||
#endif
|
||||
struct file *file = vma->vm_file;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct scoutfs_inode_info *si = SCOUTFS_I(inode);
|
||||
@@ -2055,50 +2035,27 @@ static int scoutfs_data_page_mkwrite(struct vm_area_struct *vma,
|
||||
|
||||
down_write(&si->extent_sem);
|
||||
|
||||
#ifdef KC_MPAGE_READ_FOLIO
|
||||
if (!folio_trylock(folio)) {
|
||||
#else
|
||||
if (!trylock_page(page)) {
|
||||
#endif
|
||||
ret = VM_FAULT_NOPAGE;
|
||||
goto out_sem;
|
||||
}
|
||||
ret = VM_FAULT_LOCKED;
|
||||
|
||||
#ifdef KC_MPAGE_READ_FOLIO
|
||||
if ((folio->mapping != inode->i_mapping) ||
|
||||
(!folio_test_uptodate(folio)) ||
|
||||
(folio_pos(folio) > size)) {
|
||||
folio_unlock(folio);
|
||||
#else
|
||||
if ((page->mapping != inode->i_mapping) ||
|
||||
(!PageUptodate(page)) ||
|
||||
(page_offset(page) > size)) {
|
||||
(page_offset(page) > size)) {
|
||||
unlock_page(page);
|
||||
#endif
|
||||
ret = VM_FAULT_NOPAGE;
|
||||
goto out_sem;
|
||||
}
|
||||
|
||||
#ifdef KC_MPAGE_READ_FOLIO
|
||||
if (folio_index(folio) == (size - 1) >> PAGE_SHIFT)
|
||||
#else
|
||||
if (page->index == (size - 1) >> PAGE_SHIFT)
|
||||
#endif
|
||||
len = ((size - 1) & ~PAGE_MASK) + 1;
|
||||
|
||||
#ifdef KC_MPAGE_READ_FOLIO
|
||||
err = __block_write_begin(KC_PAGE_OR_FOLIO(folio_page(folio, 0), folio), pos, PAGE_SIZE, scoutfs_get_block);
|
||||
#else
|
||||
err = __block_write_begin(page, pos, PAGE_SIZE, scoutfs_get_block);
|
||||
#endif
|
||||
if (err) {
|
||||
ret = vmf_error(err);
|
||||
#ifdef KC_MPAGE_READ_FOLIO
|
||||
folio_unlock(folio);
|
||||
#else
|
||||
unlock_page(page);
|
||||
#endif
|
||||
goto out_sem;
|
||||
}
|
||||
/* end scoutfs_write_begin */
|
||||
@@ -2108,13 +2065,8 @@ static int scoutfs_data_page_mkwrite(struct vm_area_struct *vma,
|
||||
* progress, we are guaranteed that writeback during freezing will
|
||||
* see the dirty page and writeprotect it again.
|
||||
*/
|
||||
#ifdef KC_MPAGE_READ_FOLIO
|
||||
folio_mark_dirty(folio);
|
||||
folio_wait_stable(folio);
|
||||
#else
|
||||
set_page_dirty(page);
|
||||
wait_for_stable_page(page);
|
||||
#endif
|
||||
|
||||
/* scoutfs_write_end */
|
||||
scoutfs_inode_set_data_seq(inode);
|
||||
@@ -2241,9 +2193,6 @@ const struct address_space_operations scoutfs_file_aops = {
|
||||
.dirty_folio = block_dirty_folio,
|
||||
.invalidate_folio = block_invalidate_folio,
|
||||
.read_folio = scoutfs_read_folio,
|
||||
#ifdef KC_HAVE_BUFFER_MIGRATE_FOLIO
|
||||
.migrate_folio = buffer_migrate_folio,
|
||||
#endif
|
||||
#else
|
||||
.readpage = scoutfs_readpage,
|
||||
#endif
|
||||
@@ -2252,9 +2201,7 @@ const struct address_space_operations scoutfs_file_aops = {
|
||||
#else
|
||||
.readahead = scoutfs_readahead,
|
||||
#endif
|
||||
#ifdef KC_HAVE_BLOCK_WRITE_FULL_PAGE
|
||||
.writepage = scoutfs_writepage,
|
||||
#endif
|
||||
.writepages = scoutfs_writepages,
|
||||
.write_begin = scoutfs_write_begin,
|
||||
.write_end = scoutfs_write_end,
|
||||
@@ -2269,12 +2216,8 @@ const struct file_operations scoutfs_file_fops = {
|
||||
#else
|
||||
.read_iter = scoutfs_file_read_iter,
|
||||
.write_iter = scoutfs_file_write_iter,
|
||||
.splice_write = iter_file_splice_write,
|
||||
#endif
|
||||
#ifdef KC_HAVE_GENERIC_FILE_SPLICE_READ
|
||||
.splice_read = generic_file_splice_read,
|
||||
#else
|
||||
.splice_read = copy_splice_read,
|
||||
.splice_write = iter_file_splice_write,
|
||||
#endif
|
||||
.mmap = scoutfs_file_mmap,
|
||||
.unlocked_ioctl = scoutfs_ioctl,
|
||||
|
||||
@@ -759,7 +759,6 @@ static int scoutfs_mknod(KC_VFS_NS_DEF
|
||||
struct scoutfs_lock *dir_lock = NULL;
|
||||
struct scoutfs_lock *inode_lock = NULL;
|
||||
struct scoutfs_inode_info *si;
|
||||
struct kc_timespec cur_time;
|
||||
LIST_HEAD(ind_locks);
|
||||
u64 hash;
|
||||
u64 pos;
|
||||
@@ -791,13 +790,9 @@ static int scoutfs_mknod(KC_VFS_NS_DEF
|
||||
set_dentry_fsdata(dentry, dir_lock);
|
||||
|
||||
i_size_write(dir, i_size_read(dir) + dentry->d_name.len);
|
||||
cur_time = current_time(inode);
|
||||
inode_set_mtime_to_ts(dir, cur_time);
|
||||
inode_set_ctime_to_ts(dir, cur_time);
|
||||
inode_set_mtime_to_ts(inode, cur_time);
|
||||
inode_set_atime_to_ts(inode, cur_time);
|
||||
inode_set_ctime_to_ts(inode, cur_time);
|
||||
si->crtime = inode_get_mtime(inode);
|
||||
dir->i_mtime = dir->i_ctime = current_time(inode);
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime = dir->i_mtime;
|
||||
si->crtime = inode->i_mtime;
|
||||
inode_inc_iversion(dir);
|
||||
inode_inc_iversion(inode);
|
||||
scoutfs_forest_inc_inode_count(sb);
|
||||
@@ -850,7 +845,6 @@ static int scoutfs_link(struct dentry *old_dentry,
|
||||
struct scoutfs_lock *dir_lock;
|
||||
struct scoutfs_lock *inode_lock = NULL;
|
||||
struct scoutfs_lock *orph_lock = NULL;
|
||||
struct kc_timespec cur_time;
|
||||
LIST_HEAD(ind_locks);
|
||||
bool del_orphan = false;
|
||||
u64 dir_size;
|
||||
@@ -925,10 +919,8 @@ retry:
|
||||
set_dentry_fsdata(dentry, dir_lock);
|
||||
|
||||
i_size_write(dir, dir_size);
|
||||
cur_time = current_time(inode);
|
||||
inode_set_mtime_to_ts(dir, cur_time);
|
||||
inode_set_ctime_to_ts(dir, cur_time);
|
||||
inode_set_ctime_to_ts(inode, inode_get_mtime(dir));
|
||||
dir->i_mtime = dir->i_ctime = current_time(inode);
|
||||
inode->i_ctime = dir->i_mtime;
|
||||
inc_nlink(inode);
|
||||
inode_inc_iversion(dir);
|
||||
inode_inc_iversion(inode);
|
||||
@@ -1038,13 +1030,13 @@ retry:
|
||||
|
||||
set_dentry_fsdata(dentry, dir_lock);
|
||||
|
||||
inode_set_ctime_to_ts(dir, ts);
|
||||
inode_set_mtime_to_ts(dir, ts);
|
||||
dir->i_ctime = ts;
|
||||
dir->i_mtime = ts;
|
||||
i_size_write(dir, i_size_read(dir) - dentry->d_name.len);
|
||||
inode_inc_iversion(dir);
|
||||
inode_inc_iversion(inode);
|
||||
|
||||
inode_set_ctime_to_ts(inode, ts);
|
||||
inode->i_ctime = ts;
|
||||
drop_nlink(inode);
|
||||
if (S_ISDIR(inode->i_mode)) {
|
||||
drop_nlink(dir);
|
||||
@@ -1247,7 +1239,6 @@ static int scoutfs_symlink(KC_VFS_NS_DEF
|
||||
struct scoutfs_lock *dir_lock = NULL;
|
||||
struct scoutfs_lock *inode_lock = NULL;
|
||||
struct scoutfs_inode_info *si;
|
||||
struct kc_timespec cur_time;
|
||||
LIST_HEAD(ind_locks);
|
||||
u64 hash;
|
||||
u64 pos;
|
||||
@@ -1287,13 +1278,11 @@ static int scoutfs_symlink(KC_VFS_NS_DEF
|
||||
set_dentry_fsdata(dentry, dir_lock);
|
||||
|
||||
i_size_write(dir, i_size_read(dir) + dentry->d_name.len);
|
||||
cur_time = current_time(inode);
|
||||
inode_set_mtime_to_ts(dir, cur_time);
|
||||
inode_set_ctime_to_ts(dir, cur_time);
|
||||
dir->i_mtime = dir->i_ctime = current_time(inode);
|
||||
inode_inc_iversion(dir);
|
||||
|
||||
inode_set_ctime_to_ts(inode, inode_get_mtime(dir));
|
||||
si->crtime = inode_get_ctime(inode);
|
||||
inode->i_ctime = dir->i_mtime;
|
||||
si->crtime = inode->i_ctime;
|
||||
i_size_write(inode, name_len);
|
||||
inode_inc_iversion(inode);
|
||||
scoutfs_forest_inc_inode_count(sb);
|
||||
@@ -1815,15 +1804,15 @@ retry:
|
||||
}
|
||||
|
||||
now = current_time(old_inode);
|
||||
inode_set_ctime_to_ts(old_dir, now);
|
||||
inode_set_mtime_to_ts(old_dir, now);
|
||||
old_dir->i_ctime = now;
|
||||
old_dir->i_mtime = now;
|
||||
if (new_dir != old_dir) {
|
||||
inode_set_ctime_to_ts(new_dir, now);
|
||||
inode_set_mtime_to_ts(new_dir, now);
|
||||
new_dir->i_ctime = now;
|
||||
new_dir->i_mtime = now;
|
||||
}
|
||||
inode_set_ctime_to_ts(old_inode, now);
|
||||
old_inode->i_ctime = now;
|
||||
if (new_inode)
|
||||
inode_set_ctime_to_ts(new_inode, now);
|
||||
new_inode->i_ctime = now;
|
||||
|
||||
inode_inc_iversion(old_dir);
|
||||
inode_inc_iversion(old_inode);
|
||||
@@ -1950,7 +1939,6 @@ static int scoutfs_tmpfile(KC_VFS_NS_DEF
|
||||
struct scoutfs_lock *inode_lock = NULL;
|
||||
struct scoutfs_lock *orph_lock = NULL;
|
||||
struct scoutfs_inode_info *si;
|
||||
struct kc_timespec cur_time;
|
||||
LIST_HEAD(ind_locks);
|
||||
int ret;
|
||||
|
||||
@@ -1967,11 +1955,8 @@ static int scoutfs_tmpfile(KC_VFS_NS_DEF
|
||||
if (ret < 0)
|
||||
goto out; /* XXX returning error but items created */
|
||||
|
||||
cur_time = current_time(inode);
|
||||
inode_set_mtime_to_ts(inode, cur_time);
|
||||
inode_set_ctime_to_ts(inode, cur_time);
|
||||
inode_set_atime_to_ts(inode, cur_time);
|
||||
si->crtime = inode_get_mtime(inode);
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
|
||||
si->crtime = inode->i_mtime;
|
||||
insert_inode_hash(inode);
|
||||
ihold(inode); /* need to update inode modifications in d_tmpfile */
|
||||
#ifdef KC_D_TMPFILE_DENTRY
|
||||
@@ -2021,11 +2006,7 @@ const struct inode_operations scoutfs_symlink_iops = {
|
||||
#ifdef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER
|
||||
.removexattr = generic_removexattr,
|
||||
#endif
|
||||
#ifdef KC_GET_INODE_ACL
|
||||
.get_inode_acl = scoutfs_get_acl,
|
||||
#else
|
||||
.get_acl = scoutfs_get_acl,
|
||||
#endif
|
||||
#ifndef KC_LINUX_HAVE_RHEL_IOPS_WRAPPER
|
||||
.tmpfile = scoutfs_tmpfile,
|
||||
.rename = scoutfs_rename_common,
|
||||
@@ -2039,11 +2020,7 @@ const struct inode_operations scoutfs_symlink_iops = {
|
||||
};
|
||||
|
||||
const struct file_operations scoutfs_dir_fops = {
|
||||
#ifdef KC_HAVE_ITERATE_SHARED
|
||||
.iterate_shared = scoutfs_readdir,
|
||||
#else
|
||||
.iterate = scoutfs_readdir,
|
||||
#endif
|
||||
#ifdef KC_FMODE_KABI_ITERATE
|
||||
.open = scoutfs_dir_open,
|
||||
#endif
|
||||
@@ -2075,12 +2052,8 @@ const struct inode_operations scoutfs_dir_iops = {
|
||||
.removexattr = generic_removexattr,
|
||||
#endif
|
||||
.listxattr = scoutfs_listxattr,
|
||||
#ifdef KC_GET_INODE_ACL
|
||||
.get_inode_acl = scoutfs_get_acl,
|
||||
#else
|
||||
.get_acl = scoutfs_get_acl,
|
||||
#endif
|
||||
#ifdef KC_SET_ACL_DENTRY
|
||||
#ifdef KC_GET_ACL_DENTRY
|
||||
.set_acl = scoutfs_set_acl,
|
||||
#endif
|
||||
.symlink = scoutfs_symlink,
|
||||
|
||||
@@ -217,9 +217,6 @@ static struct attribute *fence_attrs[] = {
|
||||
SCOUTFS_ATTR_PTR(rid),
|
||||
NULL,
|
||||
};
|
||||
#ifdef KC_KOBJECT_DEFAULT_GROUPS
|
||||
ATTRIBUTE_GROUPS(fence);
|
||||
#endif
|
||||
|
||||
#define FENCE_TIMEOUT_MS (MSEC_PER_SEC * 30)
|
||||
|
||||
@@ -258,8 +255,7 @@ int scoutfs_fence_start(struct super_block *sb, u64 rid, __be32 ipv4_addr, int r
|
||||
fence->rid = rid;
|
||||
|
||||
ret = scoutfs_sysfs_create_attrs_parent(sb, &fi->kset->kobj,
|
||||
&fence->ssa,
|
||||
KC_KOBJ_DEFAULT(fence),
|
||||
&fence->ssa, fence_attrs,
|
||||
"%016llx", rid);
|
||||
if (ret < 0) {
|
||||
kfree(fence);
|
||||
|
||||
@@ -149,12 +149,8 @@ static const struct inode_operations scoutfs_file_iops = {
|
||||
.removexattr = generic_removexattr,
|
||||
#endif
|
||||
.listxattr = scoutfs_listxattr,
|
||||
#ifdef KC_GET_INODE_ACL
|
||||
.get_inode_acl = scoutfs_get_acl,
|
||||
#else
|
||||
.get_acl = scoutfs_get_acl,
|
||||
#endif
|
||||
#ifdef KC_SET_ACL_DENTRY
|
||||
#ifdef KC_GET_ACL_DENTRY
|
||||
.set_acl = scoutfs_set_acl,
|
||||
#endif
|
||||
.fiemap = scoutfs_data_fiemap,
|
||||
@@ -169,12 +165,8 @@ static const struct inode_operations scoutfs_special_iops = {
|
||||
.removexattr = generic_removexattr,
|
||||
#endif
|
||||
.listxattr = scoutfs_listxattr,
|
||||
#ifdef KC_GET_INODE_ACL
|
||||
.get_inode_acl = scoutfs_get_acl,
|
||||
#else
|
||||
.get_acl = scoutfs_get_acl,
|
||||
#endif
|
||||
#ifdef KC_SET_ACL_DENTRY
|
||||
#ifdef KC_GET_ACL_DENTRY
|
||||
.set_acl = scoutfs_set_acl,
|
||||
#endif
|
||||
};
|
||||
@@ -275,9 +267,12 @@ static void load_inode(struct inode *inode, struct scoutfs_inode *cinode, int in
|
||||
i_gid_write(inode, le32_to_cpu(cinode->gid));
|
||||
inode->i_mode = le32_to_cpu(cinode->mode);
|
||||
inode->i_rdev = le32_to_cpu(cinode->rdev);
|
||||
inode_set_atime(inode, le64_to_cpu(cinode->atime.sec), le32_to_cpu(cinode->atime.nsec));
|
||||
inode_set_mtime(inode, le64_to_cpu(cinode->mtime.sec), le32_to_cpu(cinode->mtime.nsec));
|
||||
inode_set_ctime(inode, le64_to_cpu(cinode->ctime.sec), le32_to_cpu(cinode->ctime.nsec));
|
||||
inode->i_atime.tv_sec = le64_to_cpu(cinode->atime.sec);
|
||||
inode->i_atime.tv_nsec = le32_to_cpu(cinode->atime.nsec);
|
||||
inode->i_mtime.tv_sec = le64_to_cpu(cinode->mtime.sec);
|
||||
inode->i_mtime.tv_nsec = le32_to_cpu(cinode->mtime.nsec);
|
||||
inode->i_ctime.tv_sec = le64_to_cpu(cinode->ctime.sec);
|
||||
inode->i_ctime.tv_nsec = le32_to_cpu(cinode->ctime.nsec);
|
||||
|
||||
si->meta_seq = le64_to_cpu(cinode->meta_seq);
|
||||
si->data_seq = le64_to_cpu(cinode->data_seq);
|
||||
@@ -398,7 +393,6 @@ int scoutfs_getattr(KC_VFS_NS_DEF
|
||||
SCOUTFS_LKF_REFRESH_INODE, inode, &lock);
|
||||
if (ret == 0) {
|
||||
generic_fillattr(KC_VFS_INIT_NS
|
||||
KC_FILLATTR_REQUEST_MASK
|
||||
inode, stat);
|
||||
scoutfs_unlock(sb, lock, SCOUTFS_LOCK_READ);
|
||||
}
|
||||
@@ -410,7 +404,6 @@ static int set_inode_size(struct inode *inode, struct scoutfs_lock *lock,
|
||||
{
|
||||
struct scoutfs_inode_info *si = SCOUTFS_I(inode);
|
||||
struct super_block *sb = inode->i_sb;
|
||||
struct kc_timespec cur_time;
|
||||
SCOUTFS_DECLARE_PER_TASK_ENTRY(pt_ent);
|
||||
LIST_HEAD(ind_locks);
|
||||
int ret;
|
||||
@@ -433,9 +426,7 @@ static int set_inode_size(struct inode *inode, struct scoutfs_lock *lock,
|
||||
scoutfs_inode_inc_data_version(inode);
|
||||
|
||||
truncate_setsize(inode, new_size);
|
||||
cur_time = current_time(inode);
|
||||
inode_set_ctime_to_ts(inode, cur_time);
|
||||
inode_set_mtime_to_ts(inode, cur_time);
|
||||
inode->i_ctime = inode->i_mtime = current_time(inode);
|
||||
if (truncate)
|
||||
si->flags |= SCOUTFS_INO_FLAG_TRUNCATE;
|
||||
scoutfs_inode_set_data_seq(inode);
|
||||
@@ -902,14 +893,14 @@ static void store_inode(struct scoutfs_inode *cinode, struct inode *inode, int i
|
||||
cinode->gid = cpu_to_le32(i_gid_read(inode));
|
||||
cinode->mode = cpu_to_le32(inode->i_mode);
|
||||
cinode->rdev = cpu_to_le32(inode->i_rdev);
|
||||
cinode->atime.sec = cpu_to_le64(inode_get_atime_sec(inode));
|
||||
cinode->atime.nsec = cpu_to_le32(inode_get_atime_nsec(inode));
|
||||
cinode->atime.sec = cpu_to_le64(inode->i_atime.tv_sec);
|
||||
cinode->atime.nsec = cpu_to_le32(inode->i_atime.tv_nsec);
|
||||
memset(cinode->atime.__pad, 0, sizeof(cinode->atime.__pad));
|
||||
cinode->ctime.sec = cpu_to_le64(inode_get_ctime_sec(inode));
|
||||
cinode->ctime.nsec = cpu_to_le32(inode_get_ctime_nsec(inode));
|
||||
cinode->ctime.sec = cpu_to_le64(inode->i_ctime.tv_sec);
|
||||
cinode->ctime.nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
|
||||
memset(cinode->ctime.__pad, 0, sizeof(cinode->ctime.__pad));
|
||||
cinode->mtime.sec = cpu_to_le64(inode_get_mtime_sec(inode));
|
||||
cinode->mtime.nsec = cpu_to_le32(inode_get_mtime_nsec(inode));
|
||||
cinode->mtime.sec = cpu_to_le64(inode->i_mtime.tv_sec);
|
||||
cinode->mtime.nsec = cpu_to_le32(inode->i_mtime.tv_nsec);
|
||||
memset(cinode->mtime.__pad, 0, sizeof(cinode->mtime.__pad));
|
||||
|
||||
cinode->meta_seq = cpu_to_le64(scoutfs_inode_meta_seq(inode));
|
||||
@@ -1567,7 +1558,6 @@ int scoutfs_new_inode(struct super_block *sb, struct inode *dir, umode_t mode, d
|
||||
struct scoutfs_inode sinode;
|
||||
struct scoutfs_key key;
|
||||
struct inode *inode;
|
||||
struct kc_timespec cur_time;
|
||||
int inode_bytes;
|
||||
int ret;
|
||||
|
||||
@@ -1597,10 +1587,7 @@ int scoutfs_new_inode(struct super_block *sb, struct inode *dir, umode_t mode, d
|
||||
inode_init_owner(KC_VFS_INIT_NS
|
||||
inode, dir, mode);
|
||||
inode_set_bytes(inode, 0);
|
||||
cur_time = current_time(inode);
|
||||
inode_set_mtime_to_ts(inode, cur_time);
|
||||
inode_set_atime_to_ts(inode, cur_time);
|
||||
inode_set_ctime_to_ts(inode, cur_time);
|
||||
inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode);
|
||||
inode->i_rdev = rdev;
|
||||
set_inode_ops(inode);
|
||||
|
||||
@@ -2073,7 +2060,7 @@ void scoutfs_inode_schedule_orphan_dwork(struct super_block *sb)
|
||||
|
||||
low = (opts.orphan_scan_delay_ms * 80) / 100;
|
||||
high = (opts.orphan_scan_delay_ms * 120) / 100;
|
||||
delay = msecs_to_jiffies(low + get_random_u32_below(high - low)) ?: 1;
|
||||
delay = msecs_to_jiffies(low + prandom_u32_max(high - low)) ?: 1;
|
||||
|
||||
mod_delayed_work(system_wq, &inf->orphan_scan_dwork, delay);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ struct cached_item {
|
||||
unsigned int val_len;
|
||||
struct scoutfs_key key;
|
||||
u64 seq;
|
||||
char val[];
|
||||
char val[0];
|
||||
};
|
||||
|
||||
#define CACHED_ITEM_ALIGN 8
|
||||
@@ -424,7 +424,7 @@ static struct cached_item *alloc_item(struct cached_page *pg,
|
||||
item->seq = seq;
|
||||
|
||||
if (val_len)
|
||||
memcpy(&item->val[0], val, val_len);
|
||||
memcpy(item->val, val, val_len);
|
||||
|
||||
update_pg_max_seq(pg, item);
|
||||
|
||||
@@ -1999,7 +1999,7 @@ int scoutfs_item_update(struct super_block *sb, struct scoutfs_key *key,
|
||||
|
||||
if (val_len <= found->val_len) {
|
||||
if (val_len)
|
||||
memcpy(&found->val[0], val, val_len);
|
||||
memcpy(found->val, val, val_len);
|
||||
if (val_len < found->val_len)
|
||||
pg->erased_bytes += item_val_bytes(found->val_len) -
|
||||
item_val_bytes(val_len);
|
||||
@@ -2316,7 +2316,7 @@ int scoutfs_item_write_dirty(struct super_block *sb)
|
||||
lst->seq = item->seq;
|
||||
lst->flags = item->deletion ? SCOUTFS_ITEM_FLAG_DELETION : 0;
|
||||
lst->val_len = item->val_len;
|
||||
memcpy(&lst->val[0], item->val, item->val_len);
|
||||
memcpy(lst->val, item->val, item->val_len);
|
||||
}
|
||||
|
||||
spin_lock(&cinf->dirty_lock);
|
||||
@@ -2626,10 +2626,10 @@ int scoutfs_item_setup(struct super_block *sb)
|
||||
|
||||
for_each_possible_cpu(cpu)
|
||||
init_pcpu_pages(cinf, cpu);
|
||||
KC_SETUP_SHRINKER(cinf->shrinker, cinf, 0, item_cache_count_objects,
|
||||
item_cache_scan_objects, "scoutfs-item:" SCSBF, SCSB_ARGS(sb));
|
||||
if (KC_SHRINKER_IS_NULL(cinf->shrinker))
|
||||
return -ENOMEM;
|
||||
|
||||
KC_INIT_SHRINKER_FUNCS(&cinf->shrinker, item_cache_count_objects,
|
||||
item_cache_scan_objects);
|
||||
KC_REGISTER_SHRINKER(&cinf->shrinker, "scoutfs-item:" SCSBF, SCSB_ARGS(sb));
|
||||
#ifdef KC_CPU_NOTIFIER
|
||||
cinf->notifier.notifier_call = item_cpu_callback;
|
||||
register_hotcpu_notifier(&cinf->notifier);
|
||||
@@ -2654,7 +2654,7 @@ void scoutfs_item_destroy(struct super_block *sb)
|
||||
#ifdef KC_CPU_NOTIFIER
|
||||
unregister_hotcpu_notifier(&cinf->notifier);
|
||||
#endif
|
||||
KC_UNREGISTER_SHRINKER(cinf->shrinker);
|
||||
KC_UNREGISTER_SHRINKER(&cinf->shrinker);
|
||||
|
||||
for_each_possible_cpu(cpu)
|
||||
drop_pcpu_pages(sb, cinf, cpu);
|
||||
|
||||
@@ -147,13 +147,3 @@ unsigned long kc_list_lru_shrink_walk(struct list_lru *lru, struct shrink_contro
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef KC_FS_INODE_C_TIME_ACCESSOR
|
||||
struct timespec64 inode_set_ctime_current(struct inode *inode)
|
||||
{
|
||||
struct timespec64 now = current_time(inode);
|
||||
|
||||
inode_set_ctime(inode, now.tv_sec, now.tv_nsec);
|
||||
return now;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -142,54 +142,25 @@ struct timespec64 kc_current_time(struct inode *inode);
|
||||
#define kc_timespec timespec64
|
||||
#endif
|
||||
|
||||
#ifdef KC_SHRINKER_ALLOC
|
||||
// el10+
|
||||
|
||||
#define KC_DEFINE_SHRINKER(name) struct shrinker *(name)
|
||||
#define KC_SHRINKER_CONTAINER_OF(ptr, type) ptr->private_data
|
||||
#define KC_SETUP_SHRINKER(ptr, priv, flags, countfn, scanfn, fmt, args) \
|
||||
do { \
|
||||
ptr = shrinker_alloc(flags, fmt, args); \
|
||||
if (ptr) { \
|
||||
ptr->private_data = (priv); \
|
||||
ptr->seeks = DEFAULT_SEEKS; \
|
||||
ptr->count_objects = countfn; \
|
||||
ptr->scan_objects = scanfn; \
|
||||
shrinker_register(ptr); \
|
||||
} \
|
||||
} while (0)
|
||||
#define KC_UNREGISTER_SHRINKER(ptr) shrinker_free(ptr)
|
||||
#define KC_SHRINKER_FN(ptr) (ptr)
|
||||
#define KC_SHRINKER_IS_NULL(ptr) (!(ptr))
|
||||
|
||||
#else /* KC_SHRINKER_ALLOC */
|
||||
#ifndef KC_SHRINKER_SHRINK
|
||||
// el9, el8
|
||||
|
||||
#define KC_DEFINE_SHRINKER(name) struct shrinker (name)
|
||||
#define KC_DEFINE_SHRINKER(name) struct shrinker name
|
||||
#define KC_INIT_SHRINKER_FUNCS(name, countfn, scanfn) do { \
|
||||
__typeof__(name) _shrink = (name); \
|
||||
_shrink->count_objects = (countfn); \
|
||||
_shrink->scan_objects = (scanfn); \
|
||||
_shrink->seeks = DEFAULT_SEEKS; \
|
||||
} while (0)
|
||||
|
||||
#define KC_SHRINKER_CONTAINER_OF(ptr, type) container_of(ptr, type, shrinker)
|
||||
#ifdef KC_SHRINKER_NAME
|
||||
#define KC_SETUP_SHRINKER(ptr, priv, flags, countfn, scanfn, fmt, args) \
|
||||
do { \
|
||||
(ptr).count_objects = (countfn); \
|
||||
(ptr).scan_objects = (scanfn); \
|
||||
(ptr).seeks = DEFAULT_SEEKS; \
|
||||
register_shrinker(&(ptr), fmt, args); \
|
||||
} while (0)
|
||||
#define KC_REGISTER_SHRINKER register_shrinker
|
||||
#else
|
||||
#define KC_SETUP_SHRINKER(ptr, priv, flags, countfn, scanfn, fmt, args) \
|
||||
do { \
|
||||
(ptr).count_objects = (countfn); \
|
||||
(ptr).scan_objects = (scanfn); \
|
||||
(ptr).seeks = DEFAULT_SEEKS; \
|
||||
register_shrinker(&(ptr)); \
|
||||
} while (0)
|
||||
#define KC_REGISTER_SHRINKER(ptr, fmt, ...) (register_shrinker(ptr))
|
||||
#endif /* KC_SHRINKER_NAME */
|
||||
#define KC_UNREGISTER_SHRINKER(ptr) (unregister_shrinker(&(ptr)))
|
||||
#define KC_SHRINKER_FN(ptr) (&ptr)
|
||||
|
||||
#else /* KC_SHRINKER_SHRINK */
|
||||
// el7
|
||||
#define KC_UNREGISTER_SHRINKER(ptr) (unregister_shrinker(ptr))
|
||||
#define KC_SHRINKER_FN(ptr) (ptr)
|
||||
#else
|
||||
|
||||
#include <linux/shrinker.h>
|
||||
#ifndef SHRINK_STOP
|
||||
@@ -205,21 +176,19 @@ struct kc_shrinker_wrapper {
|
||||
};
|
||||
|
||||
#define KC_DEFINE_SHRINKER(name) struct kc_shrinker_wrapper name;
|
||||
#define KC_SHRINKER_CONTAINER_OF(ptr, type) container_of(container_of(ptr, struct kc_shrinker_wrapper, shrink), type, shrinker)
|
||||
#define KC_SETUP_SHRINKER(ptr, priv, flags, countfn, scanfn, fmt, args) \
|
||||
do { \
|
||||
(ptr).count_objects = (countfn); \
|
||||
(ptr).scan_objects = (scanfn); \
|
||||
(ptr).shrink.shrink = kc_shrink_wrapper_fn; \
|
||||
(ptr).shrink.seeks = DEFAULT_SEEKS; \
|
||||
register_shrinker(&(ptr).shrink); \
|
||||
#define KC_INIT_SHRINKER_FUNCS(name, countfn, scanfn) do { \
|
||||
struct kc_shrinker_wrapper *_wrap = (name); \
|
||||
_wrap->count_objects = (countfn); \
|
||||
_wrap->scan_objects = (scanfn); \
|
||||
_wrap->shrink.shrink = kc_shrink_wrapper_fn; \
|
||||
_wrap->shrink.seeks = DEFAULT_SEEKS; \
|
||||
} while (0)
|
||||
#define KC_UNREGISTER_SHRINKER(ptr) (unregister_shrinker(&(ptr).shrink))
|
||||
#define KC_SHRINKER_FN(ptr) (&(ptr).shrink)
|
||||
#define KC_SHRINKER_CONTAINER_OF(ptr, type) container_of(container_of(ptr, struct kc_shrinker_wrapper, shrink), type, shrinker)
|
||||
#define KC_REGISTER_SHRINKER(ptr, fmt, ...) (register_shrinker(ptr.shrink))
|
||||
#define KC_UNREGISTER_SHRINKER(ptr) (unregister_shrinker(ptr.shrink))
|
||||
#define KC_SHRINKER_FN(ptr) (ptr.shrink)
|
||||
|
||||
#endif /* KC_SHRINKER_SHRINK */
|
||||
#define KC_SHRINKER_IS_NULL(ptr) (0)
|
||||
#endif /* KC_SHRINKER_ALLOC */
|
||||
|
||||
#ifdef KC_KERNEL_GETSOCKNAME_ADDRLEN
|
||||
#include <linux/net.h>
|
||||
@@ -310,12 +279,6 @@ typedef unsigned int blk_opf_t;
|
||||
#endif
|
||||
#endif /* KC_VFS_METHOD_MNT_IDMAP_ARG */
|
||||
|
||||
#ifdef KC_GENERIC_FILLATTR_REQUEST_MASK
|
||||
#define KC_FILLATTR_REQUEST_MASK request_mask,
|
||||
#else
|
||||
#define KC_FILLATTR_REQUEST_MASK
|
||||
#endif
|
||||
|
||||
#ifdef KC_BIO_ALLOC_DEV_OPF_ARGS
|
||||
#define kc_bio_alloc bio_alloc
|
||||
#else
|
||||
@@ -489,7 +452,6 @@ unsigned long kc_list_lru_shrink_walk(struct list_lru *lru, struct shrink_contro
|
||||
kc_list_lru_walk_cb_t isolate, void *cb_arg);
|
||||
#else
|
||||
#define kc_list_lru_shrink_walk list_lru_shrink_walk
|
||||
#define kc_list_lru_walk list_lru_walk
|
||||
#endif
|
||||
|
||||
#if defined(KC_LIST_LRU_WALK_CB_ITEM_LOCK)
|
||||
@@ -527,133 +489,4 @@ static inline void stack_trace_print(unsigned long *entries, unsigned int nr_ent
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef KC_HAVE_GET_RANDOM_U32_BELOW
|
||||
#define get_random_u32_below prandom_u32_max
|
||||
#endif
|
||||
|
||||
#ifndef KC_FS_INODE_C_TIME_ACCESSOR
|
||||
struct timespec64 inode_set_ctime_current(struct inode *inode);
|
||||
static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode,
|
||||
struct timespec64 ts)
|
||||
{
|
||||
inode->i_ctime.tv_sec = ts.tv_sec;
|
||||
inode->i_ctime.tv_nsec = ts.tv_nsec;
|
||||
return ts;
|
||||
}
|
||||
|
||||
static inline struct timespec64 inode_set_ctime(struct inode *inode,
|
||||
time64_t sec, long nsec)
|
||||
{
|
||||
struct timespec64 ts = { .tv_sec = sec,
|
||||
.tv_nsec = nsec };
|
||||
|
||||
return inode_set_ctime_to_ts(inode, ts);
|
||||
}
|
||||
|
||||
static inline struct timespec64 inode_get_ctime(const struct inode *inode)
|
||||
{
|
||||
struct timespec64 ts = { .tv_sec = inode->i_ctime.tv_sec,
|
||||
.tv_nsec = inode->i_ctime.tv_nsec };
|
||||
return ts;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef KC_FS_INODE_AM_TIME_ACCESSOR
|
||||
static inline struct timespec64 inode_get_mtime(const struct inode *inode)
|
||||
{
|
||||
struct timespec64 ts = { .tv_sec = inode->i_mtime.tv_sec,
|
||||
.tv_nsec = inode->i_mtime.tv_nsec };
|
||||
return ts;
|
||||
}
|
||||
|
||||
static inline struct timespec64 inode_set_mtime_to_ts(struct inode *inode,
|
||||
struct timespec64 ts)
|
||||
{
|
||||
inode->i_mtime.tv_sec = ts.tv_sec;
|
||||
inode->i_mtime.tv_nsec = ts.tv_nsec;
|
||||
return ts;
|
||||
}
|
||||
|
||||
static inline struct timespec64 inode_set_mtime(struct inode *inode,
|
||||
time64_t sec, long nsec)
|
||||
{
|
||||
struct timespec64 ts = { .tv_sec = sec,
|
||||
.tv_nsec = nsec };
|
||||
|
||||
return inode_set_mtime_to_ts(inode, ts);
|
||||
}
|
||||
|
||||
static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode,
|
||||
struct timespec64 ts)
|
||||
{
|
||||
inode->i_atime.tv_sec = ts.tv_sec;
|
||||
inode->i_atime.tv_nsec = ts.tv_nsec;
|
||||
return ts;
|
||||
}
|
||||
|
||||
static inline struct timespec64 inode_set_atime(struct inode *inode,
|
||||
time64_t sec, long nsec)
|
||||
{
|
||||
struct timespec64 ts = { .tv_sec = sec,
|
||||
.tv_nsec = nsec };
|
||||
|
||||
return inode_set_atime_to_ts(inode, ts);
|
||||
}
|
||||
|
||||
static inline time64_t inode_get_ctime_sec(const struct inode *inode)
|
||||
{
|
||||
return inode->i_ctime.tv_sec;
|
||||
}
|
||||
static inline long inode_get_ctime_nsec(const struct inode *inode)
|
||||
{
|
||||
return inode->i_ctime.tv_nsec;
|
||||
}
|
||||
static inline time64_t inode_get_mtime_sec(const struct inode *inode)
|
||||
{
|
||||
return inode->i_mtime.tv_sec;
|
||||
}
|
||||
static inline long inode_get_mtime_nsec(const struct inode *inode)
|
||||
{
|
||||
return inode->i_mtime.tv_nsec;
|
||||
}
|
||||
static inline time64_t inode_get_atime_sec(const struct inode *inode)
|
||||
{
|
||||
return inode->i_atime.tv_sec;
|
||||
}
|
||||
static inline long inode_get_atime_nsec(const struct inode *inode)
|
||||
{
|
||||
return inode->i_atime.tv_nsec;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef KC_HAVE_BD_INODE
|
||||
#define KC_BDEV_INODE(b) (b)->bd_inode
|
||||
#define KC_BDEV_MAPPING(b) (b)->bd_inode->i_mapping
|
||||
#else
|
||||
#define KC_BDEV_INODE(b) (b)->bd_mapping->host
|
||||
#define KC_BDEV_MAPPING(b) (b)->bd_mapping
|
||||
#endif
|
||||
|
||||
#ifdef KC_HAVE_ASSIGN_STR_PARMS
|
||||
#define kc__assign_str(a, b) __assign_str(a, b)
|
||||
#else
|
||||
#define kc__assign_str(a, b) __assign_str(a)
|
||||
#endif
|
||||
|
||||
#ifdef KC_KOBJECT_DEFAULT_GROUPS
|
||||
#define KC_KOBJ_DEFAULT_OP default_groups
|
||||
#define KC_KOBJ_DEFAULT(name) (name##_groups)
|
||||
#define KC_KOBJ_DEFAULT_PICK(group, attrs) (group)
|
||||
#else
|
||||
#define KC_KOBJ_DEFAULT_OP default_attrs
|
||||
#define KC_KOBJ_DEFAULT(name) (name##_attrs)
|
||||
#define KC_KOBJ_DEFAULT_PICK(group, attrs) (attrs)
|
||||
#endif
|
||||
|
||||
#ifdef KC_BLOCK_WRITE_BEGIN_FOLIO
|
||||
#define KC_PAGE_OR_FOLIO(p, f) f
|
||||
#else
|
||||
#define KC_PAGE_OR_FOLIO(p, f) p
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -752,18 +752,13 @@ static struct attribute *options_attrs[] = {
|
||||
SCOUTFS_ATTR_PTR(quorum_slot_nr),
|
||||
NULL,
|
||||
};
|
||||
#ifdef KC_KOBJECT_DEFAULT_GROUPS
|
||||
ATTRIBUTE_GROUPS(options);
|
||||
#endif
|
||||
|
||||
int scoutfs_options_setup(struct super_block *sb)
|
||||
{
|
||||
DECLARE_OPTIONS_INFO(sb, optinf);
|
||||
int ret;
|
||||
|
||||
ret = scoutfs_sysfs_create_attrs(sb, &optinf->sysfs_attrs,
|
||||
KC_KOBJ_DEFAULT_PICK(options_groups, options_attrs),
|
||||
"mount_options");
|
||||
ret = scoutfs_sysfs_create_attrs(sb, &optinf->sysfs_attrs, options_attrs, "mount_options");
|
||||
if (ret < 0)
|
||||
scoutfs_options_destroy(sb);
|
||||
return ret;
|
||||
|
||||
@@ -162,7 +162,7 @@ static void quorum_slot_sin(struct scoutfs_quorum_config *qconf, int i, struct s
|
||||
static ktime_t election_timeout(void)
|
||||
{
|
||||
return ktime_add_ms(ktime_get(), SCOUTFS_QUORUM_ELECT_MIN_MS +
|
||||
get_random_u32_below(SCOUTFS_QUORUM_ELECT_VAR_MS));
|
||||
prandom_u32_max(SCOUTFS_QUORUM_ELECT_VAR_MS));
|
||||
}
|
||||
|
||||
static ktime_t heartbeat_interval(void)
|
||||
@@ -1192,9 +1192,6 @@ static struct attribute *quorum_attrs[] = {
|
||||
SCOUTFS_ATTR_PTR(is_leader),
|
||||
NULL,
|
||||
};
|
||||
#ifdef KC_KOBJECT_DEFAULT_GROUPS
|
||||
ATTRIBUTE_GROUPS(quorum);
|
||||
#endif
|
||||
|
||||
static inline bool valid_ipv4_unicast(__be32 addr)
|
||||
{
|
||||
@@ -1355,7 +1352,7 @@ int scoutfs_quorum_setup(struct super_block *sb)
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
ret = scoutfs_sysfs_create_attrs(sb, &qinf->ssa, KC_KOBJ_DEFAULT(quorum),
|
||||
ret = scoutfs_sysfs_create_attrs(sb, &qinf->ssa, quorum_attrs,
|
||||
"quorum");
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
@@ -204,7 +204,7 @@ static struct squota_check *lookup_random_check(struct rhashtable *rht)
|
||||
|
||||
tbl = rht_dereference_rcu(rht->tbl, rht);
|
||||
do {
|
||||
for (s = 0, i = get_random_u32_below(tbl->size);
|
||||
for (s = 0, i = prandom_u32_max(tbl->size);
|
||||
s < tbl->size;
|
||||
s++, i = (i + 1) % tbl->size) {
|
||||
rht_for_each_entry_rcu(chk, pos, tbl, i, head) {
|
||||
@@ -269,7 +269,7 @@ static void shrink_all_cached_checks(struct squota_info *qtinf)
|
||||
{
|
||||
struct shrink_control sc = { .nr_to_scan = LONG_MAX, };
|
||||
|
||||
scan_cached_checks(KC_SHRINKER_FN(qtinf->shrinker), &sc);
|
||||
scan_cached_checks(KC_SHRINKER_FN(&qtinf->shrinker), &sc);
|
||||
}
|
||||
|
||||
static u8 ns_is_attr(u8 ns)
|
||||
@@ -1225,12 +1225,8 @@ int scoutfs_quota_setup(struct super_block *sb)
|
||||
spin_lock_init(&qtinf->lock);
|
||||
init_waitqueue_head(&qtinf->waitq);
|
||||
|
||||
KC_SETUP_SHRINKER(qtinf->shrinker, qtinf, 0, count_cached_checks,
|
||||
scan_cached_checks, "scoutfs-quota:" SCSBF, SCSB_ARGS(sb));
|
||||
if (KC_SHRINKER_IS_NULL(qtinf->shrinker)) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
KC_INIT_SHRINKER_FUNCS(&qtinf->shrinker, count_cached_checks, scan_cached_checks);
|
||||
KC_REGISTER_SHRINKER(&qtinf->shrinker, "scoutfs-quota:" SCSBF, SCSB_ARGS(sb));
|
||||
|
||||
sbi->squota_info = qtinf;
|
||||
|
||||
@@ -1254,7 +1250,7 @@ void scoutfs_quota_destroy(struct super_block *sb)
|
||||
|
||||
if (qtinf) {
|
||||
debugfs_remove(qtinf->drop_dentry);
|
||||
KC_UNREGISTER_SHRINKER(qtinf->shrinker);
|
||||
KC_UNREGISTER_SHRINKER(&qtinf->shrinker);
|
||||
|
||||
spin_lock(&qtinf->lock);
|
||||
rs = rcu_dereference_protected(qtinf->ruleset, lockdep_is_held(&qtinf->lock));
|
||||
|
||||
@@ -102,7 +102,7 @@ TRACE_EVENT(scoutfs_setattr,
|
||||
SCSB_TRACE_ASSIGN(dentry->d_inode->i_sb);
|
||||
__entry->ino = scoutfs_ino(dentry->d_inode);
|
||||
__entry->d_len = dentry->d_name.len;
|
||||
kc__assign_str(d_name, dentry->d_name.name);
|
||||
__assign_str(d_name, dentry->d_name.name);
|
||||
__entry->ia_valid = attr->ia_valid;
|
||||
__entry->size_change = !!(attr->ia_valid & ATTR_SIZE);
|
||||
__entry->ia_size = attr->ia_size;
|
||||
@@ -1638,9 +1638,9 @@ TRACE_EVENT(scoutfs_rename,
|
||||
TP_fast_assign(
|
||||
SCSB_TRACE_ASSIGN(sb);
|
||||
__entry->old_dir_ino = scoutfs_ino(old_dir);
|
||||
kc__assign_str(old_name, old_dentry->d_name.name);
|
||||
__assign_str(old_name, old_dentry->d_name.name)
|
||||
__entry->new_dir_ino = scoutfs_ino(new_dir);
|
||||
kc__assign_str(new_name, new_dentry->d_name.name);
|
||||
__assign_str(new_name, new_dentry->d_name.name)
|
||||
__entry->new_inode_ino = new_dentry->d_inode ?
|
||||
scoutfs_ino(new_dentry->d_inode) : 0;
|
||||
),
|
||||
@@ -1670,7 +1670,7 @@ TRACE_EVENT(scoutfs_d_revalidate,
|
||||
TP_fast_assign(
|
||||
SCSB_TRACE_ASSIGN(sb);
|
||||
__entry->dentry = dentry;
|
||||
kc__assign_str(name, dentry->d_name.name);
|
||||
__assign_str(name, dentry->d_name.name)
|
||||
__entry->ino = dentry->d_inode ? scoutfs_ino(dentry->d_inode) : 0;
|
||||
__entry->dir_ino = dir_ino;
|
||||
__entry->flags = flags;
|
||||
@@ -1705,7 +1705,7 @@ TRACE_EVENT(scoutfs_validate_dentry,
|
||||
SCSB_TRACE_ASSIGN(sb);
|
||||
__entry->dentry = dentry;
|
||||
__entry->dir_ino = dir_ino;
|
||||
kc__assign_str(name, dentry->d_name.name);
|
||||
__assign_str(name, dentry->d_name.name)
|
||||
__entry->dentry_ino = dentry_ino;
|
||||
__entry->dent_ino = dent_ino;
|
||||
__entry->fsdata_gen = (unsigned long long)dentry->d_fsdata;
|
||||
@@ -1827,7 +1827,7 @@ TRACE_EVENT(scoutfs_get_name,
|
||||
SCSB_TRACE_ASSIGN(sb);
|
||||
__entry->parent_ino = scoutfs_ino(parent);
|
||||
__entry->child_ino = scoutfs_ino(child);
|
||||
kc__assign_str(name, name);
|
||||
__assign_str(name, name);
|
||||
),
|
||||
|
||||
TP_printk(SCSBF" parent %llu child %llu name: %s",
|
||||
@@ -2620,24 +2620,44 @@ TRACE_EVENT(scoutfs_block_dirty_ref,
|
||||
);
|
||||
|
||||
TRACE_EVENT(scoutfs_get_file_block,
|
||||
TP_PROTO(struct super_block *sb, u64 blkno, int flags),
|
||||
TP_PROTO(struct super_block *sb, u64 blkno, int flags,
|
||||
struct scoutfs_srch_block *srb),
|
||||
|
||||
TP_ARGS(sb, blkno, flags),
|
||||
TP_ARGS(sb, blkno, flags, srb),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
SCSB_TRACE_FIELDS
|
||||
__field(__u64, blkno)
|
||||
__field(__u32, entry_nr)
|
||||
__field(__u32, entry_bytes)
|
||||
__field(int, flags)
|
||||
__field(__u64, first_hash)
|
||||
__field(__u64, first_ino)
|
||||
__field(__u64, first_id)
|
||||
__field(__u64, last_hash)
|
||||
__field(__u64, last_ino)
|
||||
__field(__u64, last_id)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
SCSB_TRACE_ASSIGN(sb);
|
||||
__entry->blkno = blkno;
|
||||
__entry->entry_nr = __le32_to_cpu(srb->entry_nr);
|
||||
__entry->entry_bytes = __le32_to_cpu(srb->entry_bytes);
|
||||
__entry->flags = flags;
|
||||
__entry->first_hash = __le64_to_cpu(srb->first.hash);
|
||||
__entry->first_ino = __le64_to_cpu(srb->first.ino);
|
||||
__entry->first_id = __le64_to_cpu(srb->first.id);
|
||||
__entry->last_hash = __le64_to_cpu(srb->last.hash);
|
||||
__entry->last_ino = __le64_to_cpu(srb->last.ino);
|
||||
__entry->last_id = __le64_to_cpu(srb->last.id);
|
||||
),
|
||||
|
||||
TP_printk(SCSBF" blkno %llu flags 0x%x",
|
||||
SCSB_TRACE_ARGS, __entry->blkno, __entry->flags)
|
||||
TP_printk(SCSBF" blkno %llu nr %u bytes %u flags 0x%x first_hash 0x%llx first_ino %llu first_id 0x%llx last_hash 0x%llx last_ino %llu last_id 0x%llx",
|
||||
SCSB_TRACE_ARGS, __entry->blkno, __entry->entry_nr,
|
||||
__entry->entry_bytes, __entry->flags,
|
||||
__entry->first_hash, __entry->first_ino, __entry->first_id,
|
||||
__entry->last_hash, __entry->last_ino, __entry->last_id)
|
||||
);
|
||||
|
||||
TRACE_EVENT(scoutfs_block_stale,
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <net/sock.h>
|
||||
#include <net/tcp.h>
|
||||
#include <linux/log2.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include "format.h"
|
||||
#include "counters.h"
|
||||
@@ -3371,7 +3372,7 @@ out:
|
||||
|
||||
static u64 device_blocks(struct block_device *bdev, int shift)
|
||||
{
|
||||
return i_size_read(KC_BDEV_INODE(bdev)) >> shift;
|
||||
return i_size_read(bdev->bd_inode) >> shift;
|
||||
}
|
||||
|
||||
static int server_resize_devices(struct super_block *sb, struct scoutfs_net_connection *conn,
|
||||
|
||||
@@ -18,11 +18,7 @@
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/sort.h>
|
||||
#ifdef KC_HAVE__LINUX_UNALIGNED_H
|
||||
#include <linux/unaligned.h>
|
||||
#else
|
||||
#include <asm/unaligned.h>
|
||||
#endif
|
||||
|
||||
#include "super.h"
|
||||
#include "format.h"
|
||||
@@ -447,7 +443,7 @@ out:
|
||||
sfl->blocks = cpu_to_le64(blk + 1);
|
||||
|
||||
if (bl) {
|
||||
trace_scoutfs_get_file_block(sb, bl->blkno, flags);
|
||||
trace_scoutfs_get_file_block(sb, bl->blkno, flags, bl->data);
|
||||
}
|
||||
|
||||
*bl_ret = bl;
|
||||
@@ -749,6 +745,7 @@ static int search_log_file(struct super_block *sb,
|
||||
for (i = 0; i < le32_to_cpu(srb->entry_nr); i++) {
|
||||
if (pos > SCOUTFS_SRCH_BLOCK_SAFE_BYTES) {
|
||||
/* can only be inconsistency :/ */
|
||||
scoutfs_err(sb, "@@@ pos %d > %ld", pos, SCOUTFS_SRCH_BLOCK_SAFE_BYTES);
|
||||
ret = -EIO;
|
||||
break;
|
||||
}
|
||||
@@ -756,6 +753,7 @@ static int search_log_file(struct super_block *sb,
|
||||
ret = decode_entry(srb->entries + pos, &sre, &prev);
|
||||
if (ret <= 0) {
|
||||
/* can only be inconsistency :/ */
|
||||
scoutfs_err(sb, "@@@ decode_entry -> %d", ret);
|
||||
ret = -EIO;
|
||||
break;
|
||||
}
|
||||
@@ -859,6 +857,7 @@ static int search_sorted_file(struct super_block *sb,
|
||||
|
||||
if (pos > SCOUTFS_SRCH_BLOCK_SAFE_BYTES) {
|
||||
/* can only be inconsistency :/ */
|
||||
scoutfs_err(sb, "@@@ 2: pos %d > %ld", pos, SCOUTFS_SRCH_BLOCK_SAFE_BYTES);
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
@@ -866,6 +865,7 @@ static int search_sorted_file(struct super_block *sb,
|
||||
ret = decode_entry(srb->entries + pos, &sre, &prev);
|
||||
if (ret <= 0) {
|
||||
/* can only be inconsistency :/ */
|
||||
scoutfs_err(sb, "@@@ 2: decode -> %d", ret);
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
@@ -1005,6 +1005,7 @@ retry:
|
||||
scoutfs_key_inc(&key);
|
||||
memcpy(&sfl, iref.val, iref.val_len);
|
||||
} else {
|
||||
scoutfs_err(sb, "@@@ btree_next bad?");
|
||||
ret = -EIO;
|
||||
}
|
||||
scoutfs_btree_put_iref(&iref);
|
||||
@@ -1040,6 +1041,7 @@ retry:
|
||||
scoutfs_key_inc(&key);
|
||||
memcpy(<, iref.val, iref.val_len);
|
||||
} else {
|
||||
scoutfs_err(sb, "@@@ btree_next bad 2");
|
||||
ret = -EIO;
|
||||
}
|
||||
scoutfs_btree_put_iref(&iref);
|
||||
@@ -1155,6 +1157,7 @@ int scoutfs_srch_get_compact(struct super_block *sb,
|
||||
key = *iref.key;
|
||||
memcpy(sc, iref.val, iref.val_len);
|
||||
} else {
|
||||
scoutfs_err(sb, "@@@ btree_next bad 3");
|
||||
ret = -EIO;
|
||||
}
|
||||
scoutfs_btree_put_iref(&iref);
|
||||
@@ -1213,6 +1216,7 @@ int scoutfs_srch_get_compact(struct super_block *sb,
|
||||
key = *iref.key;
|
||||
memcpy(&sfl, iref.val, iref.val_len);
|
||||
} else {
|
||||
scoutfs_err(sb, "@@@ btree_next bad 4");
|
||||
ret = -EIO;
|
||||
}
|
||||
scoutfs_btree_put_iref(&iref);
|
||||
@@ -1406,8 +1410,10 @@ int scoutfs_srch_commit_compact(struct super_block *sb,
|
||||
if (ret == 0) {
|
||||
if (iref.val_len == sizeof(struct scoutfs_srch_compact))
|
||||
memcpy(busy, iref.val, iref.val_len);
|
||||
else
|
||||
else {
|
||||
scoutfs_err(sb, "@@@ btree_lookup bad");
|
||||
ret = -EIO;
|
||||
}
|
||||
scoutfs_btree_put_iref(&iref);
|
||||
}
|
||||
if (ret < 0)
|
||||
@@ -1500,6 +1506,7 @@ int scoutfs_srch_cancel_compact(struct super_block *sb,
|
||||
if (scoutfs_key_compare(iref.key, &last) > 0) {
|
||||
ret = -ENOENT;
|
||||
} else if (iref.val_len != sizeof(*sc)) {
|
||||
scoutfs_err(sb, "@@@ btree_next bad 5");
|
||||
ret = -EIO;
|
||||
} else {
|
||||
key = *iref.key;
|
||||
@@ -1613,27 +1620,29 @@ static int kway_merge(struct super_block *sb,
|
||||
/* always append new blocks */
|
||||
blk = le64_to_cpu(sfl->blocks);
|
||||
while (empty < nr) {
|
||||
if (bl == NULL) {
|
||||
if (atomic_read(&srinf->shutdown)) {
|
||||
ret = -ESHUTDOWN;
|
||||
goto out;
|
||||
if (srb == NULL || sre_cmp(&root->sre, &srb->last) != 0) {
|
||||
if (bl == NULL) {
|
||||
if (atomic_read(&srinf->shutdown)) {
|
||||
ret = -ESHUTDOWN;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* could grow and dirty to a leaf */
|
||||
if (should_commit(sb, alloc, wri,
|
||||
sfl->height + 1)) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = get_file_block(sb, alloc, wri, sfl,
|
||||
GFB_INSERT | GFB_DIRTY,
|
||||
blk, &bl);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
srb = bl->data;
|
||||
scoutfs_inc_counter(sb, srch_compact_dirty_block);
|
||||
}
|
||||
|
||||
/* could grow and dirty to a leaf */
|
||||
if (should_commit(sb, alloc, wri, sfl->height + 1)) {
|
||||
ret = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = get_file_block(sb, alloc, wri, sfl,
|
||||
GFB_INSERT | GFB_DIRTY, blk, &bl);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
srb = bl->data;
|
||||
scoutfs_inc_counter(sb, srch_compact_dirty_block);
|
||||
}
|
||||
|
||||
if (sre_cmp(&root->sre, &srb->last) != 0) {
|
||||
last_bytes = le32_to_cpu(srb->entry_bytes);
|
||||
last_tail = srb->last;
|
||||
ret = encode_entry(srb->entries +
|
||||
@@ -1641,6 +1650,7 @@ static int kway_merge(struct super_block *sb,
|
||||
&root->sre, &srb->tail);
|
||||
if (WARN_ON_ONCE(ret <= 0)) {
|
||||
/* shouldn't happen */
|
||||
scoutfs_err(sb, "@@@ encode -> %d", ret);
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
@@ -1865,6 +1875,7 @@ static int compact_logs(struct super_block *sb,
|
||||
|
||||
if (pos > SCOUTFS_SRCH_BLOCK_SAFE_BYTES) {
|
||||
/* can only be inconsistency :/ */
|
||||
scoutfs_err(sb, "@@@ 3: pos %d > %ld", pos, SCOUTFS_SRCH_BLOCK_SAFE_BYTES);
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
@@ -1872,6 +1883,7 @@ static int compact_logs(struct super_block *sb,
|
||||
ret = decode_entry(srb->entries + pos, sre, &prev);
|
||||
if (ret <= 0) {
|
||||
/* can only be inconsistency :/ */
|
||||
scoutfs_err(sb, "@@@ new decode -> %d", ret);
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
@@ -1986,6 +1998,11 @@ static int kway_get_reader(struct super_block *sb,
|
||||
rdr->skip > SCOUTFS_SRCH_BLOCK_SAFE_BYTES ||
|
||||
rdr->skip >= le32_to_cpu(srb->entry_bytes)) {
|
||||
/* XXX inconsistency */
|
||||
scoutfs_err(sb, "@@@ blkno %llu pos %u vs %ld, skip %u , %u",
|
||||
__le64_to_cpu(srb->hdr.blkno),
|
||||
rdr->pos, SCOUTFS_SRCH_BLOCK_SAFE_BYTES,
|
||||
rdr->skip,
|
||||
le32_to_cpu(srb->entry_bytes));
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@@ -2001,6 +2018,7 @@ static int kway_get_reader(struct super_block *sb,
|
||||
&rdr->decoded_sre, &rdr->prev);
|
||||
if (ret <= 0) {
|
||||
/* XXX inconsistency */
|
||||
scoutfs_err(sb, "@@@ decode new2 ret %d", ret);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@@ -2297,8 +2315,10 @@ static void scoutfs_srch_compact_worker(struct work_struct *work)
|
||||
out:
|
||||
/* our allocators and files should be stable */
|
||||
WARN_ON_ONCE(ret == -ESTALE);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
scoutfs_err(sb, "@@@ srch_compact_error %d", ret);
|
||||
scoutfs_inc_counter(sb, srch_compact_error);
|
||||
}
|
||||
|
||||
scoutfs_block_writer_forget_all(sb, &wri);
|
||||
queue_compact_work(srinf, sc != NULL && sc->nr > 0 && ret == 0);
|
||||
@@ -2350,9 +2370,6 @@ static struct attribute *srch_attrs[] = {
|
||||
SCOUTFS_ATTR_PTR(compact_delay_ms),
|
||||
NULL,
|
||||
};
|
||||
#ifdef KC_KOBJECT_DEFAULT_GROUPS
|
||||
ATTRIBUTE_GROUPS(srch);
|
||||
#endif
|
||||
|
||||
void scoutfs_srch_destroy(struct super_block *sb)
|
||||
{
|
||||
@@ -2394,8 +2411,7 @@ int scoutfs_srch_setup(struct super_block *sb)
|
||||
|
||||
sbi->srch_info = srinf;
|
||||
|
||||
ret = scoutfs_sysfs_create_attrs(sb, &srinf->ssa, KC_KOBJ_DEFAULT(srch),
|
||||
"srch");
|
||||
ret = scoutfs_sysfs_create_attrs(sb, &srinf->ssa, srch_attrs, "srch");
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ int scoutfs_write_super(struct super_block *sb,
|
||||
static bool small_bdev(struct super_block *sb, char *which, u64 blocks,
|
||||
struct block_device *bdev, int shift)
|
||||
{
|
||||
u64 size = (u64)i_size_read(KC_BDEV_INODE(bdev));
|
||||
u64 size = (u64)i_size_read(bdev->bd_inode);
|
||||
u64 count = size >> shift;
|
||||
|
||||
if (blocks > count) {
|
||||
@@ -508,7 +508,7 @@ static int scoutfs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
sb->s_time_gran = 1;
|
||||
|
||||
/* btree blocks use long lived bh->b_data refs */
|
||||
mapping_set_gfp_mask(KC_BDEV_MAPPING(sb->s_bdev), GFP_NOFS);
|
||||
mapping_set_gfp_mask(sb->s_bdev->bd_inode->i_mapping, GFP_NOFS);
|
||||
|
||||
sbi = kzalloc(sizeof(struct scoutfs_sb_info), GFP_KERNEL);
|
||||
sb->s_fs_info = sbi;
|
||||
@@ -552,7 +552,6 @@ static int scoutfs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
}
|
||||
sbi->meta_bdev_file = meta_bdev_file;
|
||||
sbi->meta_bdev = file_bdev(meta_bdev_file);
|
||||
|
||||
#else
|
||||
#ifdef KC_BLKDEV_PUT_HOLDER_ARG
|
||||
meta_bdev = blkdev_get_by_path(opts.metadev_path, SCOUTFS_META_BDEV_MODE, sb, NULL);
|
||||
@@ -568,11 +567,7 @@ static int scoutfs_fill_super(struct super_block *sb, void *data, int silent)
|
||||
sbi->meta_bdev = meta_bdev;
|
||||
#endif
|
||||
|
||||
#ifdef KC_BLKDEV_SET_BLOCKSIZE_FILE
|
||||
ret = set_blocksize(sbi->meta_bdev_file, SCOUTFS_BLOCK_SM_SIZE);
|
||||
#else
|
||||
ret = set_blocksize(sbi->meta_bdev, SCOUTFS_BLOCK_SM_SIZE);
|
||||
#endif
|
||||
if (ret != 0) {
|
||||
scoutfs_err(sb, "failed to set metadev blocksize, returned %d",
|
||||
ret);
|
||||
|
||||
@@ -103,11 +103,12 @@ static ssize_t attr_funcs_show(struct kobject *kobj, struct attribute *attr,
|
||||
}; \
|
||||
\
|
||||
static struct kobj_type _name##_ktype = { \
|
||||
.KC_KOBJ_DEFAULT_OP = KC_KOBJ_DEFAULT(_name), \
|
||||
.default_attrs = _name##_attrs, \
|
||||
.sysfs_ops = &_name##_sysfs_ops, \
|
||||
.release = _name##_release, \
|
||||
};
|
||||
|
||||
|
||||
static struct attribute *sb_id_attrs[] = {
|
||||
&data_device_maj_min_attr_funcs.attr,
|
||||
&format_version_attr_funcs.attr,
|
||||
@@ -115,9 +116,6 @@ static struct attribute *sb_id_attrs[] = {
|
||||
&rid_attr_funcs.attr,
|
||||
NULL,
|
||||
};
|
||||
#ifdef KC_KOBJECT_DEFAULT_GROUPS
|
||||
ATTRIBUTE_GROUPS(sb_id);
|
||||
#endif
|
||||
KTYPE(sb_id);
|
||||
|
||||
struct kobject *scoutfs_sysfs_sb_dir(struct super_block *sb)
|
||||
@@ -157,12 +155,7 @@ void scoutfs_sysfs_init_attrs(struct super_block *sb,
|
||||
int scoutfs_sysfs_create_attrs_parent(struct super_block *sb,
|
||||
struct kobject *parent,
|
||||
struct scoutfs_sysfs_attrs *ssa,
|
||||
#ifdef KC_KOBJECT_DEFAULT_GROUPS
|
||||
const struct attribute_group **groups,
|
||||
#else
|
||||
struct attribute **attrs,
|
||||
#endif
|
||||
char *fmt, ...)
|
||||
struct attribute **attrs, char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
size_t name_len;
|
||||
@@ -175,11 +168,7 @@ int scoutfs_sysfs_create_attrs_parent(struct super_block *sb,
|
||||
|
||||
ssa->sb = sb;
|
||||
init_completion(&ssa->comp);
|
||||
#ifdef KC_KOBJECT_DEFAULT_GROUPS
|
||||
ssa->ktype.default_groups = groups;
|
||||
#else
|
||||
ssa->ktype.default_attrs = attrs;
|
||||
#endif
|
||||
ssa->ktype.sysfs_ops = &kobj_sysfs_ops;
|
||||
ssa->ktype.release = scoutfs_sysfs_release;
|
||||
|
||||
|
||||
@@ -39,15 +39,10 @@ void scoutfs_sysfs_init_attrs(struct super_block *sb,
|
||||
int scoutfs_sysfs_create_attrs_parent(struct super_block *sb,
|
||||
struct kobject *parent,
|
||||
struct scoutfs_sysfs_attrs *ssa,
|
||||
#ifdef KC_KOBJECT_DEFAULT_GROUPS
|
||||
const struct attribute_group **groups,
|
||||
#else
|
||||
struct attribute **attrs,
|
||||
#endif
|
||||
char *fmt, ...);
|
||||
#define scoutfs_sysfs_create_attrs(sb, ssa, group_or_attrs, fmt, args...) \
|
||||
struct attribute **attrs, char *fmt, ...);
|
||||
#define scoutfs_sysfs_create_attrs(sb, ssa, attrs, fmt, args...) \
|
||||
scoutfs_sysfs_create_attrs_parent(sb, scoutfs_sysfs_sb_dir(sb), \
|
||||
ssa, group_or_attrs, fmt, ##args)
|
||||
ssa, attrs, fmt, ##args)
|
||||
|
||||
void scoutfs_sysfs_destroy_attrs(struct super_block *sb,
|
||||
struct scoutfs_sysfs_attrs *ssa);
|
||||
|
||||
@@ -52,15 +52,6 @@ static struct volopt_nr_name {
|
||||
/* initialized by setup, pointer array is null terminated */
|
||||
static struct kobj_attribute volopt_attrs[ARRAY_SIZE(volopt_table)];
|
||||
static struct attribute *volopt_attr_ptrs[ARRAY_SIZE(volopt_table) + 1];
|
||||
#ifdef KC_KOBJECT_DEFAULT_GROUPS
|
||||
static const struct attribute_group volopt_group = {
|
||||
.attrs = volopt_attr_ptrs,
|
||||
};
|
||||
static const struct attribute_group *volopt_groups[] = {
|
||||
&volopt_group,
|
||||
NULL,
|
||||
};
|
||||
#endif
|
||||
|
||||
static void get_opt_data(struct kobj_attribute *attr, struct scoutfs_volume_options *volopt,
|
||||
u64 *bit, __le64 **opt)
|
||||
@@ -173,9 +164,7 @@ int scoutfs_volopt_setup(struct super_block *sb)
|
||||
BUILD_BUG_ON(ARRAY_SIZE(volopt_table) != ARRAY_SIZE(volopt_attr_ptrs) - 1);
|
||||
volopt_attr_ptrs[i] = NULL;
|
||||
|
||||
ret = scoutfs_sysfs_create_attrs(sb, &vinf->ssa,
|
||||
KC_KOBJ_DEFAULT_PICK(volopt_groups, volopt_attr_ptrs),
|
||||
"volume_options");
|
||||
ret = scoutfs_sysfs_create_attrs(sb, &vinf->ssa, volopt_attr_ptrs, "volume_options");
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ struct wkic_item {
|
||||
u64 seq;
|
||||
unsigned int val_len;
|
||||
u8 flags;
|
||||
u8 val[] __aligned(ARCH_KMALLOC_MINALIGN); /* totls have native structs */
|
||||
u8 val[0] __aligned(ARCH_KMALLOC_MINALIGN); /* totls have native structs */
|
||||
};
|
||||
|
||||
static struct wkic_item *witem_container(struct rb_node *node)
|
||||
@@ -763,7 +763,7 @@ static void fill_page_items(struct super_block *sb, struct wkic_page *wpage, str
|
||||
pg_item->val_len = witem->val_len;
|
||||
pg_item->flags = witem->flags;
|
||||
if (witem->val_len)
|
||||
memcpy(&pg_item->val[0], witem->val, witem->val_len);
|
||||
memcpy(pg_item->val, witem->val, witem->val_len);
|
||||
|
||||
/* always inserting greatest item into page */
|
||||
rb_link_node(&pg_item->node, parent, node);
|
||||
@@ -1112,13 +1112,8 @@ int scoutfs_wkic_setup(struct super_block *sb)
|
||||
}
|
||||
|
||||
winf->sb = sb;
|
||||
KC_SETUP_SHRINKER(winf->shrinker, winf, 0, wkic_shrink_count,
|
||||
wkic_shrink_scan, "scoutfs-weak_item:" SCSBF, SCSB_ARGS(sb));
|
||||
if (KC_SHRINKER_IS_NULL(winf->shrinker)) {
|
||||
debugfs_remove(winf->drop_dentry);
|
||||
kfree(winf);
|
||||
return -ENOMEM;
|
||||
}
|
||||
KC_INIT_SHRINKER_FUNCS(&winf->shrinker, wkic_shrink_count, wkic_shrink_scan);
|
||||
KC_REGISTER_SHRINKER(&winf->shrinker, "scoutfs-weak_item:" SCSBF, SCSB_ARGS(sb));
|
||||
|
||||
sbi->wkic_info = winf;
|
||||
return 0;
|
||||
@@ -1146,7 +1141,7 @@ void scoutfs_wkic_destroy(struct super_block *sb)
|
||||
|
||||
if (winf) {
|
||||
debugfs_remove(winf->drop_dentry);
|
||||
KC_UNREGISTER_SHRINKER(winf->shrinker);
|
||||
KC_UNREGISTER_SHRINKER(&winf->shrinker);
|
||||
|
||||
/* trees are in sync so tearing down one frees all pages */
|
||||
rbtree_postorder_for_each_entry_safe(wpage, tmp, &winf->wpage_roots[0], nodes[0]) {
|
||||
|
||||
@@ -907,7 +907,7 @@ int scoutfs_xattr_set_locked(struct inode *inode, const char *name, size_t name_
|
||||
|
||||
/* XXX do these want i_mutex or anything? */
|
||||
inode_inc_iversion(inode);
|
||||
inode_set_ctime_to_ts(inode, current_time(inode));
|
||||
inode->i_ctime = current_time(inode);
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
t_filter_fs()
|
||||
{
|
||||
sed -e 's@mnt/test\.[0-9]*@mnt/test@g' \
|
||||
-e 's@Device: [a-fA-F0-9]*h/[0-9]*d@Device: 0h/0d@g' \
|
||||
-e 's@Device: [0-9]*,[0-9]*@Device: 0h/0d@g'
|
||||
-e 's@Device: [a-fA-F0-9]*h/[0-9]*d@Device: 0h/0d@g'
|
||||
}
|
||||
|
||||
#
|
||||
@@ -174,6 +173,6 @@ t_filter_dmesg()
|
||||
# creating block devices may trigger this
|
||||
re="$re|block device autoloading is deprecated and will be removed."
|
||||
|
||||
grep -v -E "($re)" | \
|
||||
egrep -v "($re)" | \
|
||||
ignore_harmless_unwind_kasan_stack_oob
|
||||
}
|
||||
|
||||
@@ -283,30 +283,6 @@ t_reinsert_remount_all()
|
||||
t_quiet t_mount_all || t_fail "mounting all failed"
|
||||
}
|
||||
|
||||
#
|
||||
# scratch helpers
|
||||
#
|
||||
t_scratch_mkfs()
|
||||
{
|
||||
scoutfs mkfs -f -Q 0,127.0.0.1,$T_SCRATCH_PORT "$T_EX_META_DEV" "$T_EX_DATA_DEV" "$@" > $T_TMP.mkfs.out 2>&1 || \
|
||||
t_fail "scratch mkfs failed"
|
||||
}
|
||||
|
||||
t_scratch_mount()
|
||||
{
|
||||
mkdir -p "$T_MSCR"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$@" "$T_EX_DATA_DEV" "$T_MSCR" || \
|
||||
t_fail "scratch mount failed"
|
||||
}
|
||||
|
||||
t_scratch_umount()
|
||||
{
|
||||
umount "$T_MSCR" || \
|
||||
t_fail "scratch umount failed"
|
||||
rmdir "$T_MSCR"
|
||||
}
|
||||
|
||||
|
||||
t_trigger_path() {
|
||||
local nr="$1"
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
== make scratch fs
|
||||
== create uid/gids
|
||||
== set acls and permissions
|
||||
== compare output
|
||||
== drop caches and compare again
|
||||
== cleanup scratch fs
|
||||
@@ -47,7 +47,7 @@ four
|
||||
--- dir within dir
|
||||
--- overwrite file
|
||||
--- can't overwrite non-empty dir
|
||||
mv: cannot overwrite '/mnt/test/test/basic-posix-consistency/dir/a/dir': Directory not empty
|
||||
mv: cannot move '/mnt/test/test/basic-posix-consistency/dir/c/clobber' to '/mnt/test/test/basic-posix-consistency/dir/a/dir': Directory not empty
|
||||
--- can overwrite empty dir
|
||||
--- can rename into root
|
||||
== path resoluion
|
||||
|
||||
@@ -1,37 +1,7 @@
|
||||
== initialize per-mount values
|
||||
== arm compaction triggers
|
||||
trigger srch_compact_logs_pad_safe armed: 1
|
||||
trigger srch_merge_stop_safe armed: 1
|
||||
trigger srch_compact_logs_pad_safe armed: 1
|
||||
trigger srch_merge_stop_safe armed: 1
|
||||
trigger srch_compact_logs_pad_safe armed: 1
|
||||
trigger srch_merge_stop_safe armed: 1
|
||||
trigger srch_compact_logs_pad_safe armed: 1
|
||||
trigger srch_merge_stop_safe armed: 1
|
||||
trigger srch_compact_logs_pad_safe armed: 1
|
||||
trigger srch_merge_stop_safe armed: 1
|
||||
== compact more often
|
||||
== create padded sorted inputs by forcing log rotation
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_compact_logs_pad_safe armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_compact_logs_pad_safe armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_compact_logs_pad_safe armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_force_log_rotate armed: 1
|
||||
trigger srch_compact_logs_pad_safe armed: 1
|
||||
== compaction of padded should stop at safe
|
||||
== verify no compaction errors
|
||||
== cleanup
|
||||
|
||||
@@ -137,6 +137,9 @@ while true; do
|
||||
test -n "$2" || die "-l must have a nr iterations argument"
|
||||
test "$2" -eq "$2" 2>/dev/null || die "-l <nr> argument must be an integer"
|
||||
T_LOOP_ITER="$2"
|
||||
|
||||
# when looping, break after first failure
|
||||
T_ABORT="1"
|
||||
shift
|
||||
;;
|
||||
-M)
|
||||
@@ -301,7 +304,7 @@ fi
|
||||
# include everything by default
|
||||
test -z "$T_INCLUDE" && T_INCLUDE="-e '.*'"
|
||||
# (quickly) exclude nothing by default
|
||||
test -z "$T_EXCLUDE" && T_EXCLUDE="-e '^$'"
|
||||
test -z "$T_EXCLUDE" && T_EXCLUDE="-e '\Zx'"
|
||||
|
||||
# eval to strip re ticks but not expand
|
||||
tests=$(grep -v "^#" $T_SEQUENCE |
|
||||
@@ -399,31 +402,44 @@ if [ -n "$T_INSMOD" ]; then
|
||||
cmd insmod "$T_MODULE"
|
||||
fi
|
||||
|
||||
if [ -n "$T_TRACE_MULT" ]; then
|
||||
# orig_trace_size=$(cat /sys/kernel/debug/tracing/buffer_size_kb)
|
||||
orig_trace_size=1408
|
||||
mult_trace_size=$((orig_trace_size * T_TRACE_MULT))
|
||||
msg "increasing trace buffer size from $orig_trace_size KiB to $mult_trace_size KiB"
|
||||
echo $mult_trace_size > /sys/kernel/debug/tracing/buffer_size_kb
|
||||
fi
|
||||
start_tracing() {
|
||||
if [ -n "$T_TRACE_MULT" ]; then
|
||||
orig_trace_size=1408
|
||||
mult_trace_size=$((orig_trace_size * T_TRACE_MULT))
|
||||
msg "increasing trace buffer size from $orig_trace_size KiB to $mult_trace_size KiB"
|
||||
echo $mult_trace_size > /sys/kernel/debug/tracing/buffer_size_kb
|
||||
fi
|
||||
|
||||
nr_globs=${#T_TRACE_GLOB[@]}
|
||||
if [ $nr_globs -gt 0 ]; then
|
||||
echo 0 > /sys/kernel/debug/tracing/events/scoutfs/enable
|
||||
nr_globs=${#T_TRACE_GLOB[@]}
|
||||
if [ $nr_globs -gt 0 ]; then
|
||||
echo 0 > /sys/kernel/debug/tracing/events/scoutfs/enable
|
||||
|
||||
for g in "${T_TRACE_GLOB[@]}"; do
|
||||
for e in /sys/kernel/debug/tracing/events/scoutfs/$g/enable; do
|
||||
if test -w "$e"; then
|
||||
echo 1 > "$e"
|
||||
else
|
||||
die "-t glob '$g' matched no scoutfs events"
|
||||
fi
|
||||
for g in "${T_TRACE_GLOB[@]}"; do
|
||||
for e in /sys/kernel/debug/tracing/events/scoutfs/$g/enable; do
|
||||
if test -w "$e"; then
|
||||
echo 1 > "$e"
|
||||
else
|
||||
die "-t glob '$g' matched no scoutfs events"
|
||||
fi
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
nr_events=$(cat /sys/kernel/debug/tracing/set_event | wc -l)
|
||||
msg "enabled $nr_events trace events from $nr_globs -t globs"
|
||||
fi
|
||||
nr_events=$(cat /sys/kernel/debug/tracing/set_event | wc -l)
|
||||
msg "enabled $nr_events trace events from $nr_globs -t globs"
|
||||
fi
|
||||
}
|
||||
|
||||
stop_tracing() {
|
||||
if [ -n "$T_TRACE_GLOB" -o -n "$T_TRACE_PRINTK" ]; then
|
||||
msg "saving traces and disabling tracing"
|
||||
echo 0 > /sys/kernel/debug/tracing/events/scoutfs/enable
|
||||
echo 0 > /sys/kernel/debug/tracing/options/trace_printk
|
||||
cat /sys/kernel/debug/tracing/trace | gzip > "$T_RESULTS/traces.gz"
|
||||
if [ -n "$orig_trace_size" ]; then
|
||||
echo $orig_trace_size > /sys/kernel/debug/tracing/buffer_size_kb
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -n "$T_TRACE_PRINTK" ]; then
|
||||
echo "$T_TRACE_PRINTK" > /sys/kernel/debug/tracing/options/trace_printk
|
||||
@@ -505,10 +521,7 @@ crash_monitor()
|
||||
fi
|
||||
|
||||
if [ "$bad" != 0 ]; then
|
||||
echo "run-tests monitor syncing and triggering crash"
|
||||
# hail mary, the sync could well hang
|
||||
(echo s > /proc/sysrq-trigger) &
|
||||
sleep 5
|
||||
echo "run-tests monitor triggering crash"
|
||||
echo c > /proc/sysrq-trigger
|
||||
exit 1
|
||||
fi
|
||||
@@ -603,24 +616,26 @@ passed=0
|
||||
skipped=0
|
||||
failed=0
|
||||
skipped_permitted=0
|
||||
for t in $tests; do
|
||||
# tests has basenames from sequence, get path and name
|
||||
t="tests/$t"
|
||||
test_name=$(basename "$t" | sed -e 's/.sh$//')
|
||||
for iter in $(seq 1 $T_LOOP_ITER); do
|
||||
|
||||
# get stats from previous pass
|
||||
last="$T_RESULTS/last-passed-test-stats"
|
||||
stats=$(grep -s "^$test_name " "$last" | cut -d " " -f 2-)
|
||||
test -n "$stats" && stats="last: $stats"
|
||||
printf " %-30s $stats" "$test_name"
|
||||
start_tracing
|
||||
|
||||
# mark in dmesg as to what test we are running
|
||||
echo "run scoutfs test $test_name" > /dev/kmsg
|
||||
for t in $tests; do
|
||||
# tests has basenames from sequence, get path and name
|
||||
t="tests/$t"
|
||||
test_name=$(basename "$t" | sed -e 's/.sh$//')
|
||||
|
||||
# let the test get at its extra files
|
||||
T_EXTRA="$T_TESTS/extra/$test_name"
|
||||
# get stats from previous pass
|
||||
last="$T_RESULTS/last-passed-test-stats"
|
||||
stats=$(grep -s "^$test_name " "$last" | cut -d " " -f 2-)
|
||||
test -n "$stats" && stats="last: $stats"
|
||||
printf " %-30s $stats" "$test_name"
|
||||
|
||||
for iter in $(seq 1 $T_LOOP_ITER); do
|
||||
# mark in dmesg as to what test we are running
|
||||
echo "run scoutfs test $test_name" > /dev/kmsg
|
||||
|
||||
# let the test get at its extra files
|
||||
T_EXTRA="$T_TESTS/extra/$test_name"
|
||||
|
||||
# create a temporary dir and file path for the test
|
||||
T_TMPDIR="$T_RESULTS/tmp/$test_name"
|
||||
@@ -628,9 +643,6 @@ for t in $tests; do
|
||||
cmd rm -rf "$T_TMPDIR"
|
||||
cmd mkdir -p "$T_TMPDIR"
|
||||
|
||||
# assign scratch mount point in temporary dir
|
||||
T_MSCR="$T_TMPDIR/scratch"
|
||||
|
||||
# create a test name dir in the fs, clean up old data as needed
|
||||
T_DS=""
|
||||
for i in $(seq 0 $((T_NR_MOUNTS - 1))); do
|
||||
@@ -710,55 +722,43 @@ for t in $tests; do
|
||||
sts=$T_FAIL_STATUS
|
||||
fi
|
||||
|
||||
# stop looping if we didn't pass
|
||||
if [ "$sts" != "$T_PASS_STATUS" ]; then
|
||||
break;
|
||||
# show and record the result of the test
|
||||
if [ "$sts" == "$T_PASS_STATUS" ]; then
|
||||
echo " passed: $stats"
|
||||
((passed++))
|
||||
# save stats for passed test
|
||||
grep -s -v "^$test_name " "$last" > "$last.tmp"
|
||||
echo "$test_name $stats" >> "$last.tmp"
|
||||
mv -f "$last.tmp" "$last"
|
||||
elif [ "$sts" == "$T_SKIP_PERMITTED_STATUS" ]; then
|
||||
echo " [ skipped (permitted): $message ]"
|
||||
echo "$test_name skipped (permitted) $message " >> "$T_RESULTS/skip.log"
|
||||
((skipped_permitted++))
|
||||
elif [ "$sts" == "$T_SKIP_STATUS" ]; then
|
||||
echo " [ skipped: $message ]"
|
||||
echo "$test_name $message" >> "$T_RESULTS/skip.log"
|
||||
((skipped++))
|
||||
elif [ "$sts" == "$T_FAIL_STATUS" ]; then
|
||||
echo " [ failed: $message ]"
|
||||
echo "$test_name $message" >> "$T_RESULTS/fail.log"
|
||||
((failed++))
|
||||
|
||||
if [ -n "$T_ABORT" ]; then
|
||||
stop_tracing
|
||||
die "aborting after first failure"
|
||||
fi
|
||||
fi
|
||||
|
||||
# record results for TAP format output
|
||||
t_tap_progress $test_name $sts
|
||||
((testcount++))
|
||||
done
|
||||
|
||||
# show and record the result of the test
|
||||
if [ "$sts" == "$T_PASS_STATUS" ]; then
|
||||
echo " passed: $stats"
|
||||
((passed++))
|
||||
# save stats for passed test
|
||||
grep -s -v "^$test_name " "$last" > "$last.tmp"
|
||||
echo "$test_name $stats" >> "$last.tmp"
|
||||
mv -f "$last.tmp" "$last"
|
||||
elif [ "$sts" == "$T_SKIP_PERMITTED_STATUS" ]; then
|
||||
echo " [ skipped (permitted): $message ]"
|
||||
echo "$test_name skipped (permitted) $message " >> "$T_RESULTS/skip.log"
|
||||
((skipped_permitted++))
|
||||
elif [ "$sts" == "$T_SKIP_STATUS" ]; then
|
||||
echo " [ skipped: $message ]"
|
||||
echo "$test_name $message" >> "$T_RESULTS/skip.log"
|
||||
((skipped++))
|
||||
elif [ "$sts" == "$T_FAIL_STATUS" ]; then
|
||||
echo " [ failed: $message ]"
|
||||
echo "$test_name $message" >> "$T_RESULTS/fail.log"
|
||||
((failed++))
|
||||
|
||||
test -n "$T_ABORT" && die "aborting after first failure"
|
||||
fi
|
||||
|
||||
# record results for TAP format output
|
||||
t_tap_progress $test_name $sts
|
||||
((testcount++))
|
||||
|
||||
stop_tracing
|
||||
done
|
||||
|
||||
msg "all tests run: $passed passed, $skipped skipped, $skipped_permitted skipped (permitted), $failed failed"
|
||||
|
||||
|
||||
if [ -n "$T_TRACE_GLOB" -o -n "$T_TRACE_PRINTK" ]; then
|
||||
msg "saving traces and disabling tracing"
|
||||
echo 0 > /sys/kernel/debug/tracing/events/scoutfs/enable
|
||||
echo 0 > /sys/kernel/debug/tracing/options/trace_printk
|
||||
cat /sys/kernel/debug/tracing/trace > "$T_RESULTS/traces"
|
||||
if [ -n "$orig_trace_size" ]; then
|
||||
echo $orig_trace_size > /sys/kernel/debug/tracing/buffer_size_kb
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$skipped" == 0 -a "$failed" == 0 ]; then
|
||||
msg "all tests passed"
|
||||
unmount_all
|
||||
|
||||
@@ -2,7 +2,6 @@ export-get-name-parent.sh
|
||||
basic-block-counts.sh
|
||||
basic-bad-mounts.sh
|
||||
basic-posix-acl.sh
|
||||
basic-acl-consistency.sh
|
||||
inode-items-updated.sh
|
||||
simple-inode-index.sh
|
||||
simple-staging.sh
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
|
||||
#
|
||||
# Test basic clustered posix acl consistency.
|
||||
#
|
||||
|
||||
t_require_commands getfacl setfacl
|
||||
|
||||
GETFACL="getfacl --absolute-names"
|
||||
|
||||
filter_scratch() {
|
||||
sed "s@$T_MSCR@t_mscr@g"
|
||||
}
|
||||
|
||||
acl_compare()
|
||||
{
|
||||
diff -u - <($GETFACL $T_MSCR/data/dir_a/dir_b | filter_scratch) <<EOF1
|
||||
# file: t_mscr/data/dir_a/dir_b
|
||||
# owner: t_usr_3
|
||||
# group: t_grp_3
|
||||
# flags: -s-
|
||||
user::rwx
|
||||
group::rwx
|
||||
group:t_grp_2:r-x
|
||||
mask::rwx
|
||||
other::---
|
||||
default:user::rwx
|
||||
default:group::rwx
|
||||
default:group:t_grp_2:r-x
|
||||
default:group:t_grp_3:rwx
|
||||
default:mask::rwx
|
||||
default:other::---
|
||||
|
||||
EOF1
|
||||
|
||||
test $? -eq 0 || t_fail "dir_b differs"
|
||||
|
||||
diff -u - <($GETFACL -p $T_MSCR/data/dir_a/dir_b/dir_c/dir_d | filter_scratch) <<EOF3
|
||||
# file: t_mscr/data/dir_a/dir_b/dir_c/dir_d
|
||||
# owner: t_usr_1
|
||||
# group: t_grp_1
|
||||
# flags: -s-
|
||||
user::rwx
|
||||
group::rwx
|
||||
group:t_grp_2:r-x
|
||||
mask::rwx
|
||||
other::---
|
||||
default:user::rwx
|
||||
default:group::rwx
|
||||
default:group:t_grp_2:r-x
|
||||
default:group:t_grp_3:rwx
|
||||
default:mask::rwx
|
||||
default:other::---
|
||||
|
||||
EOF3
|
||||
test $? -eq 0 || t_fail "dir_d differs"
|
||||
|
||||
diff -u - <($GETFACL $T_MSCR/data/dir_a/dir_b/dir_c | filter_scratch) <<EOF2
|
||||
# file: t_mscr/data/dir_a/dir_b/dir_c
|
||||
# owner: t_usr_3
|
||||
# group: t_grp_2
|
||||
# flags: -s-
|
||||
user::rwx
|
||||
group::rwx
|
||||
group:t_grp_2:r-x
|
||||
mask::rwx
|
||||
other::---
|
||||
default:user::rwx
|
||||
default:group::rwx
|
||||
default:group:t_grp_2:r-x
|
||||
default:group:t_grp_3:rwx
|
||||
default:mask::rwx
|
||||
default:other::---
|
||||
|
||||
EOF2
|
||||
test $? -eq 0 || t_fail "dir_c differs"
|
||||
}
|
||||
echo "== make scratch fs"
|
||||
t_scratch_mkfs
|
||||
t_scratch_mount
|
||||
|
||||
rm -rf $T_MSCR/data
|
||||
|
||||
echo "== create uid/gids"
|
||||
groupadd -g 7101 t_grp_1 > /dev/null 2>&1
|
||||
useradd -g 7101 -u 7101 t_usr_1 > /dev/null 2>&1
|
||||
groupadd -g 7102 t_grp_2 > /dev/null 2>&1
|
||||
groupadd -g 7103 t_grp_3 > /dev/null 2>&1
|
||||
useradd -g 7103 -u 7103 t_usr_3 > /dev/null 2>&1
|
||||
|
||||
echo "== set acls and permissions"
|
||||
mkdir -p $T_MSCR/data/dir_a/dir_b
|
||||
chown t_usr_3:t_grp_3 $T_MSCR/data/dir_a/dir_b
|
||||
chmod 2770 $T_MSCR/data/dir_a/dir_b
|
||||
setfacl -m g:t_grp_2:rx $T_MSCR/data/dir_a/dir_b
|
||||
setfacl -m d:g:t_grp_2:rx $T_MSCR/data/dir_a/dir_b
|
||||
setfacl -m d:g:t_grp_3:rwx $T_MSCR/data/dir_a/dir_b
|
||||
|
||||
mkdir -p $T_MSCR/data/dir_a/dir_b/dir_c
|
||||
chown t_usr_3:t_grp_2 $T_MSCR/data/dir_a/dir_b/dir_c
|
||||
setfacl -x g:t_grp_3 $T_MSCR/data/dir_a/dir_b/dir_c
|
||||
|
||||
mkdir -p $T_MSCR/data/dir_a/dir_b/dir_c/dir_d
|
||||
chown t_usr_1:t_grp_1 $T_MSCR/data/dir_a/dir_b/dir_c/dir_d
|
||||
setfacl -x g:t_grp_3 $T_MSCR/data/dir_a/dir_b/dir_c/dir_d
|
||||
|
||||
echo "== compare output"
|
||||
acl_compare
|
||||
|
||||
echo "== drop caches and compare again"
|
||||
sync
|
||||
echo 3 > /proc/sys/vm/drop_caches
|
||||
acl_compare
|
||||
|
||||
echo "== cleanup scratch fs"
|
||||
t_scratch_umount
|
||||
|
||||
t_pass
|
||||
@@ -12,22 +12,25 @@ mount_fail()
|
||||
}
|
||||
|
||||
echo "== prepare devices, mount point, and logs"
|
||||
t_scratch_mkfs
|
||||
SCR="$T_TMPDIR/mnt.scratch"
|
||||
mkdir -p "$SCR"
|
||||
> $T_TMP.mount.out
|
||||
scoutfs mkfs -f -Q 0,127.0.0.1,$T_SCRATCH_PORT "$T_EX_META_DEV" "$T_EX_DATA_DEV" > $T_TMP.mkfs.out 2>&1 \
|
||||
|| t_fail "mkfs failed"
|
||||
|
||||
echo "== bad devices, bad options"
|
||||
mount_fail -o _bad /dev/null /dev/null "$T_MSCR"
|
||||
mount_fail -o _bad /dev/null /dev/null "$SCR"
|
||||
|
||||
echo "== swapped devices"
|
||||
mount_fail -o metadev_path=$T_EX_DATA_DEV,quorum_slot_nr=0 "$T_EX_META_DEV" "$T_MSCR"
|
||||
mount_fail -o metadev_path=$T_EX_DATA_DEV,quorum_slot_nr=0 "$T_EX_META_DEV" "$SCR"
|
||||
|
||||
echo "== both meta devices"
|
||||
mount_fail -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_META_DEV" "$T_MSCR"
|
||||
mount_fail -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_META_DEV" "$SCR"
|
||||
|
||||
echo "== both data devices"
|
||||
mount_fail -o metadev_path=$T_EX_DATA_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR"
|
||||
mount_fail -o metadev_path=$T_EX_DATA_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR"
|
||||
|
||||
echo "== good volume, bad option and good options"
|
||||
mount_fail -o _bad,metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR"
|
||||
mount_fail -o _bad,metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR"
|
||||
|
||||
t_pass
|
||||
|
||||
@@ -138,9 +138,7 @@ echo "--- can't overwrite non-empty dir"
|
||||
mkdir "$T_D0/dir/a/dir"
|
||||
touch "$T_D0/dir/a/dir/nope"
|
||||
mkdir "$T_D1/dir/c/clobber"
|
||||
mv -T "$T_D1/dir/c/clobber" "$T_D1/dir/a/dir" 2>&1 | \
|
||||
sed "s@mv: cannot move '.*' to '\(.*\)': Directory not empty@mv: cannot overwrite '\1': Directory not empty@g" | \
|
||||
t_filter_fs
|
||||
mv -T "$T_D1/dir/c/clobber" "$T_D1/dir/a/dir" 2>&1 | t_filter_fs
|
||||
find "$T_D0/dir" -ls 2>&1 | t_filter_fs > "$T_TMP.0"
|
||||
find "$T_D1/dir" -ls 2>&1 | t_filter_fs > "$T_TMP.1"
|
||||
diff -u "$T_TMP.0" "$T_TMP.1"
|
||||
|
||||
@@ -11,8 +11,9 @@ truncate -s $sz "$T_TMP.equal"
|
||||
truncate -s $large_sz "$T_TMP.large"
|
||||
|
||||
echo "== make scratch fs"
|
||||
t_scratch_mkfs
|
||||
mkdir -p "$T_MSCR"
|
||||
t_quiet scoutfs mkfs -f -Q 0,127.0.0.1,$T_SCRATCH_PORT "$T_EX_META_DEV" "$T_EX_DATA_DEV"
|
||||
SCR="$T_TMPDIR/mnt.scratch"
|
||||
mkdir -p "$SCR"
|
||||
|
||||
echo "== small new data device fails"
|
||||
t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.small"
|
||||
@@ -22,13 +23,13 @@ t_rc scoutfs prepare-empty-data-device --check "$T_EX_META_DEV" "$T_TMP.small"
|
||||
t_rc scoutfs prepare-empty-data-device --check "$T_EX_META_DEV"
|
||||
|
||||
echo "== preparing while mounted fails"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR"
|
||||
t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.equal"
|
||||
umount "$T_MSCR"
|
||||
umount "$SCR"
|
||||
|
||||
echo "== preparing without recovery fails"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR"
|
||||
umount -f "$T_MSCR"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR"
|
||||
umount -f "$SCR"
|
||||
t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.equal"
|
||||
|
||||
echo "== check sees metadata errors"
|
||||
@@ -36,16 +37,16 @@ t_rc scoutfs prepare-empty-data-device --check "$T_EX_META_DEV"
|
||||
t_rc scoutfs prepare-empty-data-device --check "$T_EX_META_DEV" "$T_TMP.equal"
|
||||
|
||||
echo "== preparing with file data fails"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR"
|
||||
echo hi > "$T_MSCR"/file
|
||||
umount "$T_MSCR"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR"
|
||||
echo hi > "$SCR"/file
|
||||
umount "$SCR"
|
||||
scoutfs print "$T_EX_META_DEV" > "$T_TMP.print"
|
||||
t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.equal"
|
||||
|
||||
echo "== preparing after emptied"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$T_MSCR"
|
||||
rm -f "$T_MSCR"/file
|
||||
umount "$T_MSCR"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$T_EX_DATA_DEV" "$SCR"
|
||||
rm -f "$SCR"/file
|
||||
umount "$SCR"
|
||||
t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.equal"
|
||||
|
||||
echo "== checks pass"
|
||||
@@ -54,22 +55,22 @@ t_rc scoutfs prepare-empty-data-device --check "$T_EX_META_DEV" "$T_TMP.equal"
|
||||
|
||||
echo "== using prepared"
|
||||
scr_loop=$(losetup --find --show "$T_TMP.equal")
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$scr_loop" "$T_MSCR"
|
||||
touch "$T_MSCR"/equal_prepared
|
||||
equal_tot=$(scoutfs statfs -s total_data_blocks -p "$T_MSCR")
|
||||
umount "$T_MSCR"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$scr_loop" "$SCR"
|
||||
touch "$SCR"/equal_prepared
|
||||
equal_tot=$(scoutfs statfs -s total_data_blocks -p "$SCR")
|
||||
umount "$SCR"
|
||||
losetup -d "$scr_loop"
|
||||
|
||||
echo "== preparing larger and resizing"
|
||||
t_rc scoutfs prepare-empty-data-device "$T_EX_META_DEV" "$T_TMP.large"
|
||||
scr_loop=$(losetup --find --show "$T_TMP.large")
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$scr_loop" "$T_MSCR"
|
||||
touch "$T_MSCR"/large_prepared
|
||||
ls "$T_MSCR"
|
||||
scoutfs resize-devices -p "$T_MSCR" -d $large_sz
|
||||
large_tot=$(scoutfs statfs -s total_data_blocks -p "$T_MSCR")
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 "$scr_loop" "$SCR"
|
||||
touch "$SCR"/large_prepared
|
||||
ls "$SCR"
|
||||
scoutfs resize-devices -p "$SCR" -d $large_sz
|
||||
large_tot=$(scoutfs statfs -s total_data_blocks -p "$SCR")
|
||||
test "$large_tot" -gt "$equal_tot" ; echo "resized larger test rc: $?"
|
||||
umount "$T_MSCR"
|
||||
umount "$SCR"
|
||||
losetup -d "$scr_loop"
|
||||
|
||||
echo "== cleanup"
|
||||
|
||||
@@ -54,16 +54,21 @@ after=$(free_blocks Data "$T_M0")
|
||||
test "$before" == "$after" || \
|
||||
t_fail "$after free data blocks after rm, expected $before"
|
||||
|
||||
# XXX this is all pretty manual, would be nice to have helpers
|
||||
echo "== make small meta fs"
|
||||
# meta device just big enough for reserves and the metadata we'll fill
|
||||
t_scratch_mkfs -A -m 10G
|
||||
t_scratch_mount
|
||||
scoutfs mkfs -A -f -Q 0,127.0.0.1,$T_SCRATCH_PORT -m 10G "$T_EX_META_DEV" "$T_EX_DATA_DEV" > $T_TMP.mkfs.out 2>&1 || \
|
||||
t_fail "mkfs failed"
|
||||
SCR="$T_TMPDIR/mnt.scratch"
|
||||
mkdir -p "$SCR"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 \
|
||||
"$T_EX_DATA_DEV" "$SCR"
|
||||
|
||||
echo "== create large xattrs until we fill up metadata"
|
||||
mkdir -p "$T_MSCR/xattrs"
|
||||
mkdir -p "$SCR/xattrs"
|
||||
|
||||
for f in $(seq 1 100000); do
|
||||
file="$T_MSCR/xattrs/file-$f"
|
||||
file="$SCR/xattrs/file-$f"
|
||||
touch "$file"
|
||||
|
||||
LC_ALL=C create_xattr_loop -c 1000 -n user.scoutfs-enospc -p "$file" -s 65535 > $T_TMP.cxl 2>&1
|
||||
@@ -79,10 +84,10 @@ for f in $(seq 1 100000); do
|
||||
done
|
||||
|
||||
echo "== remove files with xattrs after enospc"
|
||||
rm -rf "$T_MSCR/xattrs"
|
||||
rm -rf "$SCR/xattrs"
|
||||
|
||||
echo "== make sure we can create again"
|
||||
file="$T_MSCR/file-after"
|
||||
file="$SCR/file-after"
|
||||
C=120
|
||||
while (( C-- )); do
|
||||
touch $file 2> /dev/null && break
|
||||
@@ -94,6 +99,7 @@ sync
|
||||
rm -f "$file"
|
||||
|
||||
echo "== cleanup small meta fs"
|
||||
t_scratch_umount
|
||||
umount "$SCR"
|
||||
rmdir "$SCR"
|
||||
|
||||
t_pass
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
# format version.
|
||||
#
|
||||
|
||||
# not supported on el8, or higher versions.
|
||||
if [ $(source /etc/os-release ; echo ${VERSION_ID} | cut -d. -f1) -gt 7 ]; then
|
||||
# not supported on el8 or higher
|
||||
if [ $(source /etc/os-release ; echo ${VERSION_ID:0:1}) -gt 7 ]; then
|
||||
t_skip_permitted "Unsupported OS version"
|
||||
fi
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ df_free() {
|
||||
}
|
||||
|
||||
same_totals() {
|
||||
cur_meta_tot=$(statfs_total meta "$T_MSCR")
|
||||
cur_data_tot=$(statfs_total data "$T_MSCR")
|
||||
cur_meta_tot=$(statfs_total meta "$SCR")
|
||||
cur_data_tot=$(statfs_total data "$SCR")
|
||||
|
||||
test "$cur_meta_tot" == "$exp_meta_tot" || \
|
||||
t_fail "cur total_meta_blocks $cur_meta_tot != expected $exp_meta_tot"
|
||||
@@ -34,10 +34,10 @@ same_totals() {
|
||||
# some slop to account for reserved blocks and concurrent allocation.
|
||||
#
|
||||
devices_grew() {
|
||||
cur_meta_tot=$(statfs_total meta "$T_MSCR")
|
||||
cur_data_tot=$(statfs_total data "$T_MSCR")
|
||||
cur_meta_df=$(df_free MetaData "$T_MSCR")
|
||||
cur_data_df=$(df_free Data "$T_MSCR")
|
||||
cur_meta_tot=$(statfs_total meta "$SCR")
|
||||
cur_data_tot=$(statfs_total data "$SCR")
|
||||
cur_meta_df=$(df_free MetaData "$SCR")
|
||||
cur_data_df=$(df_free Data "$SCR")
|
||||
|
||||
local grow_meta_tot=$(echo "$exp_meta_tot * 2" | bc)
|
||||
local grow_data_tot=$(echo "$exp_data_tot * 2" | bc)
|
||||
@@ -70,13 +70,19 @@ size_data=$(blockdev --getsize64 "$T_EX_DATA_DEV")
|
||||
quarter_meta=$(echo "$size_meta / 4" | bc)
|
||||
quarter_data=$(echo "$size_data / 4" | bc)
|
||||
|
||||
# XXX this is all pretty manual, would be nice to have helpers
|
||||
echo "== make initial small fs"
|
||||
t_scratch_mkfs -A -m $quarter_meta -d $quarter_data
|
||||
t_scratch_mount
|
||||
scoutfs mkfs -A -f -Q 0,127.0.0.1,$T_SCRATCH_PORT -m $quarter_meta -d $quarter_data \
|
||||
"$T_EX_META_DEV" "$T_EX_DATA_DEV" > $T_TMP.mkfs.out 2>&1 || \
|
||||
t_fail "mkfs failed"
|
||||
SCR="$T_TMPDIR/mnt.scratch"
|
||||
mkdir -p "$SCR"
|
||||
mount -t scoutfs -o metadev_path=$T_EX_META_DEV,quorum_slot_nr=0 \
|
||||
"$T_EX_DATA_DEV" "$SCR"
|
||||
|
||||
# then calculate sizes based on blocks that mkfs used
|
||||
quarter_meta=$(echo "$(statfs_total meta "$T_MSCR") * 64 * 1024" | bc)
|
||||
quarter_data=$(echo "$(statfs_total data "$T_MSCR") * 4 * 1024" | bc)
|
||||
quarter_meta=$(echo "$(statfs_total meta "$SCR") * 64 * 1024" | bc)
|
||||
quarter_data=$(echo "$(statfs_total data "$SCR") * 4 * 1024" | bc)
|
||||
whole_meta=$(echo "$quarter_meta * 4" | bc)
|
||||
whole_data=$(echo "$quarter_data * 4" | bc)
|
||||
outsize_meta=$(echo "$whole_meta * 2" | bc)
|
||||
@@ -87,58 +93,59 @@ shrink_meta=$(echo "$quarter_meta / 2" | bc)
|
||||
shrink_data=$(echo "$quarter_data / 2" | bc)
|
||||
|
||||
# and save expected values for checks
|
||||
exp_meta_tot=$(statfs_total meta "$T_MSCR")
|
||||
exp_meta_df=$(df_free MetaData "$T_MSCR")
|
||||
exp_data_tot=$(statfs_total data "$T_MSCR")
|
||||
exp_data_df=$(df_free Data "$T_MSCR")
|
||||
exp_meta_tot=$(statfs_total meta "$SCR")
|
||||
exp_meta_df=$(df_free MetaData "$SCR")
|
||||
exp_data_tot=$(statfs_total data "$SCR")
|
||||
exp_data_df=$(df_free Data "$SCR")
|
||||
|
||||
echo "== 0s do nothing"
|
||||
scoutfs resize-devices -p "$T_MSCR"
|
||||
scoutfs resize-devices -p "$T_MSCR" -m 0
|
||||
scoutfs resize-devices -p "$T_MSCR" -d 0
|
||||
scoutfs resize-devices -p "$T_MSCR" -m 0 -d 0
|
||||
scoutfs resize-devices -p "$SCR"
|
||||
scoutfs resize-devices -p "$SCR" -m 0
|
||||
scoutfs resize-devices -p "$SCR" -d 0
|
||||
scoutfs resize-devices -p "$SCR" -m 0 -d 0
|
||||
|
||||
echo "== shrinking fails"
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $shrink_meta
|
||||
scoutfs resize-devices -p "$T_MSCR" -d $shrink_data
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $shrink_meta -d $shrink_data
|
||||
scoutfs resize-devices -p "$SCR" -m $shrink_meta
|
||||
scoutfs resize-devices -p "$SCR" -d $shrink_data
|
||||
scoutfs resize-devices -p "$SCR" -m $shrink_meta -d $shrink_data
|
||||
same_totals
|
||||
|
||||
echo "== existing sizes do nothing"
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $quarter_meta
|
||||
scoutfs resize-devices -p "$T_MSCR" -d $quarter_data
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $quarter_meta -d $quarter_data
|
||||
scoutfs resize-devices -p "$SCR" -m $quarter_meta
|
||||
scoutfs resize-devices -p "$SCR" -d $quarter_data
|
||||
scoutfs resize-devices -p "$SCR" -m $quarter_meta -d $quarter_data
|
||||
same_totals
|
||||
|
||||
echo "== growing outside device fails"
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $outsize_meta
|
||||
scoutfs resize-devices -p "$T_MSCR" -d $outsize_data
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $outsize_meta -d $outsize_data
|
||||
scoutfs resize-devices -p "$SCR" -m $outsize_meta
|
||||
scoutfs resize-devices -p "$SCR" -d $outsize_data
|
||||
scoutfs resize-devices -p "$SCR" -m $outsize_meta -d $outsize_data
|
||||
same_totals
|
||||
|
||||
echo "== resizing meta works"
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $half_meta
|
||||
scoutfs resize-devices -p "$SCR" -m $half_meta
|
||||
devices_grew meta
|
||||
|
||||
echo "== resizing data works"
|
||||
scoutfs resize-devices -p "$T_MSCR" -d $half_data
|
||||
scoutfs resize-devices -p "$SCR" -d $half_data
|
||||
devices_grew data
|
||||
|
||||
echo "== shrinking back fails"
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $quarter_meta
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $quarter_data
|
||||
scoutfs resize-devices -p "$SCR" -m $quarter_meta
|
||||
scoutfs resize-devices -p "$SCR" -m $quarter_data
|
||||
same_totals
|
||||
|
||||
echo "== resizing again does nothing"
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $half_meta
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $half_data
|
||||
scoutfs resize-devices -p "$SCR" -m $half_meta
|
||||
scoutfs resize-devices -p "$SCR" -m $half_data
|
||||
same_totals
|
||||
|
||||
echo "== resizing to full works"
|
||||
scoutfs resize-devices -p "$T_MSCR" -m $whole_meta -d $whole_data
|
||||
scoutfs resize-devices -p "$SCR" -m $whole_meta -d $whole_data
|
||||
devices_grew meta data
|
||||
|
||||
echo "== cleanup extra fs"
|
||||
t_scratch_umount
|
||||
umount "$SCR"
|
||||
rmdir "$SCR"
|
||||
|
||||
t_pass
|
||||
|
||||
@@ -31,8 +31,8 @@ trap restore_compact_delay EXIT
|
||||
|
||||
echo "== arm compaction triggers"
|
||||
for nr in $(t_fs_nrs); do
|
||||
t_trigger_arm srch_compact_logs_pad_safe $nr
|
||||
t_trigger_arm srch_merge_stop_safe $nr
|
||||
t_trigger_arm_silent srch_compact_logs_pad_safe $nr
|
||||
t_trigger_arm_silent srch_merge_stop_safe $nr
|
||||
done
|
||||
|
||||
echo "== compact more often"
|
||||
@@ -44,7 +44,7 @@ echo "== create padded sorted inputs by forcing log rotation"
|
||||
sv=$(t_server_nr)
|
||||
for i in $(seq 1 $COMPACT_NR); do
|
||||
for j in $(seq 1 $COMPACT_NR); do
|
||||
t_trigger_arm srch_force_log_rotate $sv
|
||||
t_trigger_arm_silent srch_force_log_rotate $sv
|
||||
|
||||
seq -f "f-$i-$j-$SEQF" 1 10 | \
|
||||
bulk_create_paths -X "scoutfs.srch.t-srch-safe-merge-pos" -d "$T_D0" > \
|
||||
@@ -59,7 +59,7 @@ for i in $(seq 1 $COMPACT_NR); do
|
||||
while test $padded == 0 && sleep .5; do
|
||||
for nr in $(t_fs_nrs); do
|
||||
if [ "$(t_trigger_get srch_compact_logs_pad_safe $nr)" == "0" ]; then
|
||||
t_trigger_arm srch_compact_logs_pad_safe $nr
|
||||
t_trigger_arm_silent srch_compact_logs_pad_safe $nr
|
||||
padded=1
|
||||
break
|
||||
fi
|
||||
|
||||
@@ -71,7 +71,7 @@ else
|
||||
m64=""
|
||||
fi
|
||||
|
||||
sparse $m64 $include $search/include "$@" 2>&1 | grep -v -E "($RE)" | tee .sparse.output
|
||||
sparse $m64 $include $search/include "$@" 2>&1 | egrep -v "($RE)" | tee .sparse.output
|
||||
|
||||
rm -f $defines
|
||||
|
||||
|
||||
Reference in New Issue
Block a user