* check: fix a false alert where extent record has wrong metadata flag
* improved stability on fuzzed/crafted images when reading sys array in
superblock
- * build: the 'ar' tool is properly deteced during cross-compilation
- * debug-tree: option -t understands ids for tree root and chnuk tree
+ * build: the 'ar' tool is properly detected during cross-compilation
+ * debug-tree: option -t understands ids for tree root and chunk tree
* preparatory work for btrfs-convert rewrite
* sparse, gcc warning fixes
* more memory allocation failure handling
subvolume
* other:
* check: add progress indicator
- * scrub: enahced error message
+ * scrub: enhanced error message
* show-super: read superblock from a given offset
* add README
* docs: update manual page for mkfs.btrfs, btrfstune, balance,
btrfs-progs-4.2.3 (2015-10-19)
* subvol sync: make it actually work again: it's been broken since 4.1.2,
- due to a reversed condition it returned immediatelly instead of waiting
+ due to a reversed condition it returned immediately instead of waiting
* scanning: do not scan already discovered filesystems (minor optimization)
* convert: better error message in case the filesystem is not finalized
* restore: off-by-one symlink path check fix
* documentation updates
* debug-tree: print nbytes
* test: image for corrupted nbytes
- * corupt-block: let it kill nbytes
+ * corrupt-block: let it kill nbytes
btrfs-progs-4.1 (2015-06-22)
Bugfixes:
* debug tree: print key names according to their C name
New:
- * rescure zero-log
+ * rescue zero-log
* btrfsune:
* rewrite uuid on a filesystem image
* new option to turn on NO_HOLES incompat feature
* is has been created large enough. each path is zero-terminated and accessed
* from ipath->fspath->val[i].
* when it returns, there are ipath->fspath->elem_cnt number of paths available
- * in ipath->fspath->val[]. when the allocated space wasn't sufficient, the
- * number of missed paths in recored in ipath->fspath->elem_missed, otherwise,
+ * in ipath->fspath->val[]. When the allocated space wasn't sufficient, the
+ * number of missed paths is recorded in ipath->fspath->elem_missed, otherwise,
* it's zero. ipath->fspath->bytes_missing holds the number of bytes that would
* have been needed to return all paths.
*/
ret = pwrite(fd, buf, sectorsize, bytenr);
if (ret != sectorsize) {
fprintf(stderr,
- "error during zeroing supreblock %d: %d\n",
+ "error during zeroing superblock %d: %d\n",
i, ret);
goto fail;
}
root = btrfs_read_fs_root(root->fs_info, &root_key);
if (IS_ERR(root)) {
- fprintf(stderr, "Couldn't finde owner root %llu\n",
+ fprintf(stderr, "Couldn't find owner root %llu\n",
key.objectid);
return PTR_ERR(root);
}
}
/* corrupt item using NO cow.
- * Because chunk recover will recover based on whole partition scaning,
+ * Because chunk recover will recover based on whole partition scanning,
* If using COW, chunk recover will use the old item to recover,
* which is still OK but we want to check the ability to rebuild chunk
* not only restore the old ones */
("buf", ctypes.c_ubyte * args_buffer_size),
]
-# the search ioctl resturns one header for each item
+# the search ioctl returns one header for each item
#
class btrfs_ioctl_search_header(ctypes.Structure):
_pack_ = 1
async->bufsize = compressBound(async->size);
async->buffer = malloc(async->bufsize);
if (!async->buffer) {
- fprintf(stderr, "Error allocing buffer\n");
+ fprintf(stderr, "Error allocating buffer\n");
pthread_mutex_lock(&md->mutex);
if (!md->error)
md->error = -ENOMEM;
ret = metadump_init(&metadump, root, out, num_threads,
compress_level, sanitize);
if (ret) {
- fprintf(stderr, "Error initing metadump %d\n", ret);
+ fprintf(stderr, "Error initializing metadump %d\n", ret);
close_ctree(root);
return ret;
}
path = btrfs_alloc_path();
if (!path) {
- fprintf(stderr, "Out of memory allocing path\n");
+ fprintf(stderr, "Out of memory allocating path\n");
err = -ENOMEM;
goto out;
}
outfd = fileno(mdres->out);
buffer = malloc(compress_size);
if (!buffer) {
- fprintf(stderr, "Error allocing buffer\n");
+ fprintf(stderr, "Error allocating buffer\n");
pthread_mutex_lock(&mdres->mutex);
if (!mdres->error)
mdres->error = -ENOMEM;
async->bufsize = le32_to_cpu(item->size);
async->buffer = malloc(async->bufsize);
if (!async->buffer) {
- fprintf(stderr, "Error allocing async buffer\n");
+ fprintf(stderr, "Error allocating async buffer\n");
free(async);
return -ENOMEM;
}
fs_chunk = malloc(sizeof(struct fs_chunk));
if (!fs_chunk) {
- fprintf(stderr, "Erorr allocating chunk\n");
+ fprintf(stderr, "Error allocating chunk\n");
ret = -ENOMEM;
break;
}
buffer = malloc(max_size);
if (!buffer) {
- fprintf(stderr, "Error allocing buffer\n");
+ fprintf(stderr, "Error allocating buffer\n");
free(cluster);
return -ENOMEM;
}
if (mdres->compress_method == COMPRESS_ZLIB) {
tmp = malloc(max_size);
if (!tmp) {
- fprintf(stderr, "Error allocing tmp buffer\n");
+ fprintf(stderr, "Error allocating tmp buffer\n");
free(cluster);
free(buffer);
return -ENOMEM;
buffer = malloc(le32_to_cpu(item->size));
if (!buffer) {
- fprintf(stderr, "Error allocing buffer\n");
+ fprintf(stderr, "Error allocating buffer\n");
return -ENOMEM;
}
path = btrfs_alloc_path();
if (!path) {
- fprintf(stderr, "Error alloc'ing path\n");
+ fprintf(stderr, "Error allocating path\n");
return -ENOMEM;
}
ret = mdrestore_init(&mdrestore, in, out, old_restore, num_threads,
fixup_offset, info, multi_devices);
if (ret) {
- fprintf(stderr, "Error initing mdrestore %d\n", ret);
+ fprintf(stderr, "Error initializing mdrestore %d\n", ret);
goto failed_cluster;
}
int add_len;
/*
- * ref_tree = 0 indicates the subvolumes
+ * ref_tree = 0 indicates the subvolume
* has been deleted.
*/
if (!found->ref_tree) {
}
/* finding the generation for a given path is a two step process.
- * First we use the inode loookup routine to find out the root id
+ * First we use the inode lookup routine to find out the root id
*
* Then we use the tree search ioctl to scan all the root items for a
* given root id and spit out the latest generation we can find
generation);
/*
* According to the current kernel code, the following
- * case is impossble, or there is something wrong in
+ * case is impossible, or there is something wrong in
* the kernel code.
*/
if (memcmp(((void *)exist) + offset,
btrfs_dev_extent_chunk_offset(l, dev_extent)) {
if (rc->verbose)
fprintf(stderr,
- "Device tree unmatch with chunks dev_extent[%llu, %llu], chunk[%llu, %llu]\n",
+ "Device tree mismatch with chunks dev_extent[%llu, %llu], chunk[%llu, %llu]\n",
btrfs_dev_extent_chunk_offset(l,
dev_extent),
btrfs_dev_extent_length(l, dev_extent),
if (chunk->type_flags != btrfs_disk_block_group_flags(l, bg_ptr)) {
if (rc->verbose)
fprintf(stderr,
- "Chunk[%llu, %llu]'s type(%llu) is differemt with Block Group's type(%llu)\n",
+ "Chunk[%llu, %llu]'s type(%llu) is different with Block Group's type(%llu)\n",
chunk->offset, chunk->length, chunk->type_flags,
btrfs_disk_block_group_flags(l, bg_ptr));
btrfs_release_path(&path);
}
/*
- * Convert 64bit range to 32bit with boundary checkso
+ * Convert 64bit range to 32bit with boundary checks
*/
static int range_to_u32(u64 start, u64 end, u32 *start32, u32 *end32)
{
}
static const char balance_cmd_group_info[] =
-"balance data accross devices, or change block groups using filters";
+"balance data across devices, or change block groups using filters";
const struct cmd_group balance_cmd_group = {
balance_cmd_group_usage, balance_cmd_group_info, {
return -EEXIST;
/*
- * Now there will be no overflap, delete the hole and re-add the
+ * Now there will be no overlap, delete the hole and re-add the
* split(s) if they exists.
*/
if (start > hole->start) {
if (errors & REF_ERR_DUP_INODE_REF)
fprintf(stderr, ", dup inode ref");
if (errors & REF_ERR_INDEX_UNMATCH)
- fprintf(stderr, ", index unmatch");
+ fprintf(stderr, ", index mismatch");
if (errors & REF_ERR_FILETYPE_UNMATCH)
- fprintf(stderr, ", filetype unmatch");
+ fprintf(stderr, ", filetype mismatch");
if (errors & REF_ERR_NAME_TOO_LONG)
fprintf(stderr, ", name too long");
if (errors & REF_ERR_NO_ROOT_REF)
type_recovered = 1;
filetype = BTRFS_FT_REG_FILE;
} else{
- printf("Can't determint the filetype for inode %llu, assume it is a normal file\n",
+ printf("Can't determine the filetype for inode %llu, assume it is a normal file\n",
rec->ino);
type_recovered = 1;
filetype = BTRFS_FT_REG_FILE;
/*
* We need to record the highest inode number for later 'lost+found'
* dir creation.
- * We must select a ino not used/refered by any existing inode, or
+ * We must select an ino not used/referred by any existing inode, or
* 'lost+found' ino may be a missing ino in a corrupted leaf,
* this may cause 'lost+found' dir has wrong nlinks.
*/
} else {
/*
* Signal to callers we need to start the scan over
- * again since we'll have cow'ed blocks.
+ * again since we'll have cowed blocks.
*/
ret = -EAGAIN;
}
ret = verify_space_cache(root, cache);
if (ret) {
- fprintf(stderr, "cache appears valid but isnt %Lu\n",
+ fprintf(stderr, "cache appears valid but isn't %Lu\n",
cache->key.objectid);
error++;
}
path = btrfs_alloc_path();
if (!path) {
- fprintf(stderr, "Error allocing path\n");
+ fprintf(stderr, "Error allocating path\n");
return -ENOMEM;
}
/*
* Block group items come before extent items if they have the same
- * bytenr, so walk back one more just in case. Dear future traveler,
+ * bytenr, so walk back one more just in case. Dear future traveller,
* first congrats on mastering time travel. Now if it's not too much
* trouble could you go back to 2006 and tell Chris to make the
* BLOCK_GROUP_ITEM_KEY (and BTRFS_*_REF_KEY) lower than the
* 1) If BTRFS_HEADER_FLAG_RELOC is set then we have FULL_BACKREF set.
* 2) If btrfs_header_owner(buf) no longer points to buf then we have
* FULL_BACKREF set.
- * 3) We cow'ed the block walking down a reloc tree. This is impossible to tell
+ * 3) We cowed the block walking down a reloc tree. This is impossible to tell
* if it happened after the relocation occurred since we'll have dropped the
* reloc root, so it's entirely possible to have FULL_BACKREF set on buf and
* have no real way to know for sure.
if (tmp->start + tmp->nr < good->start + good->nr) {
fprintf(stderr, "Ok we have overlapping extents that "
- "aren't completely covered by eachother, this "
+ "aren't completely covered by each other, this "
"is going to require more careful thought. "
"The extents are [%Lu-%Lu] and [%Lu-%Lu]\n",
tmp->start, tmp->nr, good->start, good->nr);
ret = reset_balance(trans, fs_info);
if (ret)
- fprintf(stderr, "error reseting the pending balance\n");
+ fprintf(stderr, "error resetting the pending balance\n");
return ret;
}
const char * const cmd_check_usage[] = {
"btrfs check [options] <device>",
- "Check structural inegrity of a filesystem (unmounted).",
- "Check structural inegrity of an unmounted filesystem. Verify internal",
+ "Check structural integrity of a filesystem (unmounted).",
+ "Check structural integrity of an unmounted filesystem. Verify internal",
"trees' consistency and item connectivity. In the repair mode try to",
"fix the problems found.",
"WARNING: the repair mode is considered dangerous",
"--readonly run in read-only mode (default)",
"--init-csum-tree create a new CRC tree",
"--init-extent-tree create a new extent tree",
- "--check-data-csum verify checkums of data blocks",
+ "--check-data-csum verify checksums of data blocks",
"-Q|--qgroup-report print a report on qgroup consistency",
"-E|--subvol-extents <subvolid>",
" print subvolume extents and sharing state",
/*
* What we want to do here is get a count of shared bytes within the
- * set of extents we have collected. Specifcally, we don't want to
+ * set of extents we have collected. Specifically, we don't want to
* count any byte more than once, so just adding them up doesn't
* work.
*
}
/*
- * This function computes the space occuped by a *single* RAID5/RAID6 chunk.
+ * This function computes the space occupied by a *single* RAID5/RAID6 chunk.
* The computation is performed on the basis of the number of stripes
* which compose the chunk, which could be different from the number of devices
* if a disk is added later.
key.objectid = BTRFS_FS_TREE_OBJECTID;
key.offset = (u64)-1;
- printf("Calculatin' size of fs tree\n");
+ printf("Calculating size of fs tree\n");
ret = calc_root_size(root, &key, 1);
if (ret)
goto out;
/*
* List of device extents is sorted by descending order of the extent's
* end offset. If some extent goes beyond the computed minimum size,
- * which initially matches the sum of the lenghts of all extents,
+ * which initially matches the sum of the lengths of all extents,
* we need to check if the extent can be relocated to an hole in the
* device between [0, *min_size[ (which is what the resize ioctl does).
*/
r->write_fd = open(path, O_RDWR);
if (r->write_fd < 0) {
ret = -errno;
- error("cannont open %s: %s", path, strerror(-ret));
+ error("cannot open %s: %s", path, strerror(-ret));
goto out;
}
strncpy_null(r->write_path, path);
/*
* returns 0 if the key did not match (nothing was read)
* 1 if the key did match (success)
- * -1 if the key did match and an error occured
+ * -1 if the key did match and an error occurred
*/
static int scrub_kvread(int *i, int len, int avail, const char *buf,
const char *key, u64 *dest)
goto out;
if (!ret) {
ret = -EINVAL;
- error("subvolum %s is not read-only", subvol);
+ error("subvolume %s is not read-only", subvol);
goto out;
}
}
struct extent_buffer *buf)
{
/*
- * Tree blocks not in refernece counted trees and tree roots
+ * Tree blocks not in reference counted trees and tree roots
* are never shared. If a block was allocated after the last
* snapshot and the block was not allocated by tree relocation,
* we know the block is not shared.
/*
* the key defines the order in the tree, and so it also defines (optimal)
- * block layout. objectid corresonds to the inode number. The flags
+ * block layout. objectid corresponds to the inode number. The flags
* tells us things about the object, and is a kind of stream selector.
* so for a given inode, keys with flags of 1 might refer to the inode
* data, flags of 2 may point to file data in the btree and flags == 3
/*
* starting byte of this partition on the device,
- * to allowr for stripe alignment in the future
+ * to allow for stripe alignment in the future
*/
__le64 start_offset;
/*
* This generation number is used to test if the new fields are valid
- * and up to date while reading the root item. Everytime the root item
+ * and up to date while reading the root item. Every time the root item
* is written out, the "generation" field is copied into this field. If
* anyone ever mounted the fs with an older kernel, we will have
* mismatching generation values here and thus must invalidate the
name, name_len);
/*
* FIXME: at some point we should handle xattr's that are larger than
- * what we can fit in our leaf. We set location to NULL b/c we arent
+ * what we can fit in our leaf. We set location to NULL b/c we aren't
* pointing at anything else, that will change if we store the xattr
* data in a separate inode.
*/
OPEN_CTREE_SUPPRESS_CHECK_BLOCK_ERRORS +
__OPEN_CTREE_RETURN_CHUNK_ROOT,
/*
- * TODO: cleanup: Split the open_ctree_flags into more indepent
- * tree bits.
+ * TODO: cleanup: Split the open_ctree_flags into more independent
+ * Tree bits.
* Like split PARTIAL into SKIP_CSUM/SKIP_EXTENT
*/
struct cache_extent *search_cache_extent(struct cache_tree *tree, u64 start);
/*
- * Find a cahce_extent which restrictly covers start.
+ * Find a cache_extent which restrictly covers start.
*
* If not found, return NULL.
*/
if (ret <= 0)
goto out;
if (ret > 0) {
- /* Check preivous file extent */
+ /* Check previous file extent */
ret = btrfs_previous_item(root, path, ino,
BTRFS_EXTENT_DATA_KEY);
if (ret < 0)
not_found = 1;
/*
- * To keep the search hehavior consistent with search_slot(),
+ * To keep the search behavior consistent with search_slot(),
* we need to go back to the prev leaf's nritem slot if
* we are at the first slot of the leaf.
*/
* Unlike inode.c in kernel, which can use most of the kernel infrastructure
* like inode/dentry things, in user-land, we can only use inode number to
* do directly operation on extent buffer, which may cause extra searching,
- * but should not be a huge problem since progs is less performence sensitive.
+ * but should not be a huge problem since progs is less performance sensitive.
*/
#include <sys/stat.h>
* dir_item if any of them exists.
*
* If an inode's nlink is reduced to 0 and 'add_orphan' is true, it will be
- * added to orphan inode and wairing to be deleted by next kernel mount.
+ * added to orphan inode and waiting to be deleted by next kernel mount.
*/
int btrfs_unlink(struct btrfs_trans_handle *trans, struct btrfs_root *root,
u64 ino, u64 parent_ino, u64 index, const char *name,
__u64 tree_bytes_scrubbed; /* # of tree bytes scrubbed */
__u64 read_errors; /* # of read errors encountered (EIO) */
__u64 csum_errors; /* # of failed csum checks */
- __u64 verify_errors; /* # of occurences, where the metadata
+ __u64 verify_errors; /* # of occurrences, where the metadata
* of a tree block did not match the
* expected values, like generation or
* logical */
__u64 last_physical; /* last physical address scrubbed. In
* case a scrub was aborted, this can
* be used to restart the scrub */
- __u64 unverified_errors; /* # of occurences where a read for a
+ __u64 unverified_errors; /* # of occurrences where a read for a
* full (64k) bio failed, but the re-
* check succeeded for each 4k piece.
* Intermittent error. */
/* report balance progress to userspace */
struct btrfs_balance_progress {
__u64 expected; /* estimated # of chunks that will be
- * relocated to fulfill the request */
+ * relocated to fulfil the request */
__u64 considered; /* # of chunks we have considered so far */
__u64 completed; /* # of chunks relocated so far */
};
/*
- * taken from linux kernel lib/list_sort.c, removed uneeded code and adapted
+ * taken from linux kernel lib/list_sort.c, removed unneeded code and adapted
* for btrfsprogs
*/
BTRFS_BLOCK_GROUP_DATA);
if (ret == -ENOSPC) {
fprintf(stderr,
- "no space to alloc data/metadata chunk\n");
+ "no space to allocate data/metadata chunk\n");
goto err;
}
BUG_ON(ret);
&chunk_start, &chunk_size,
BTRFS_BLOCK_GROUP_METADATA);
if (ret == -ENOSPC) {
- fprintf(stderr, "no space to alloc metadata chunk\n");
+ fprintf(stderr, "no space to allocate metadata chunk\n");
goto err;
}
BUG_ON(ret);
&chunk_start, &chunk_size,
BTRFS_BLOCK_GROUP_DATA);
if (ret == -ENOSPC) {
- fprintf(stderr, "no space to alloc data chunk\n");
+ fprintf(stderr, "no space to allocate data chunk\n");
goto err;
}
BUG_ON(ret);
* 1) Empty chunk
* Temp chunk is always empty.
*
- * 2) profile dismatch with mkfs profile.
+ * 2) profile mismatch with mkfs profile.
* Temp chunk is always in SINGLE
*
* 3) Size differs with mkfs_alloc
if (group_profile_max_safe_loss(metadata_profile) <
group_profile_max_safe_loss(data_profile)){
fprintf(stderr,
- "WARNING: metatdata has lower redundancy than data!\n\n");
+ "WARNING: metadata has lower redundancy than data!\n\n");
}
mkfs_cfg.label = label;
}
/*
- * this function will be only called if kernel dosen't support uuid tree.
+ * this function will be only called if kernel doesn't support uuid tree.
*/
static struct subvol_info *subvol_uuid_search_old(struct subvol_uuid_search *s,
u64 root_id, const u8 *uuid, u64 transid,
shapeit(data)
# try to drop out the least common data points by creating
-# a historgram of the sectors seen.
+# a histogram of the sectors seen.
sectors = data[:,0]
sizes = data[:,1]
datalen = len(data)
f = figure(figsize=(8,6))
-# Throughput goes at the botoom
+# Throughput goes at the bottom
a = subplot(1, 1, 1)
subplots_adjust(right=0.7)
datai = 0
ret = 3;
goto no_recover;
}
- /* reset super_bytenr in order that we will rewite all supers */
+ /* reset super_bytenr in order that we will rewrite all supers */
root->fs_info->super_bytenr = BTRFS_SUPER_INFO_OFFSET;
ret = write_all_supers(root);
if (!ret)
no_recover:
recover_err_str(ret);
free_recover_superblock(&recover);
- /* check if we have freed fs_deivces in close_ctree() */
+ /* check if we have freed fs_devices in close_ctree() */
if (!root)
btrfs_close_devices(recover.fs_devices);
return ret;
## Selective testing
-The test are prefixed by a number for ordering and uniquenes. To run a
+The test are prefixed by a number for ordering and uniqueness. To run a
particular test use:
```shell
* Use the highest unused number in the sequence, write a short descriptive title
and join by dashes `-`.
-* Write a short description of the bug and how it's teste to the comment at the
+* Write a short description of the bug and how it's tested to the comment at the
begining of `test.sh`.
* Write the test commands, comment anything that's not obvious.
check_prereq()
{
if ! [ -f $TOP/$1 ]; then
- _fail "Failed prerequisities: $1";
+ _fail "Failed prerequisites: $1";
fi
}
# Allow child test to use $TOP and $RESULTS
export TOP
export RESULTS
-# For custom script needs to verfiy recovery
+# For custom script needs to verify recovery
export LANG
rm -f $RESULTS
# Allow child test to use $TOP and $RESULTS
export TOP
export RESULTS
-# For custom script needs to verfiy recovery
+# For custom script needs to verify recovery
export LANG
# For tests that only use a loop device
export IMAGE
#!/bin/bash
# test btrfs subvolume run normally with more than one subvolume
#
-# - btrfs subvolume must not loop indefinetelly
+# - btrfs subvolume must not loop indefinitely
# - btrfs subvolume return 0 in normal case
source $TOP/tests/common
run_check_mount_test_dev
# to check following thing in both 1 and multiple subvolume case:
-# 1: is subvolume sync loop indefinetelly
+# 1: is subvolume sync loop indefinitely
# 2: is return value right
#
run_check $SUDO_HELPER $TOP/btrfs subvolume create "$TEST_MNT"/mysubvol1
#!/bin/bash
#
-# Verify that subovolume sync waits until the subvolume is cleaned
+# Verify that subvolume sync waits until the subvolume is cleaned
source $TOP/tests/common
#!/bin/bash
#
-# Verify that subovolume sync waits until the subvolume is cleaned and does not
+# Verify that subvolume sync waits until the subvolume is cleaned and does not
# crash at the end
source $TOP/tests/common
# Allow child test to use $TOP and $RESULTS
export TOP
export RESULTS
-# For custom script needs to verfiy recovery
+# For custom script needs to verify recovery
export LANG
# For tests that only use a loop device
export IMAGE
# Invalid: Aligned sectorsize with unaligned nodesize
do_test 4k 16385 && _fail
-# Invalid: Ungliend sectorsize with aligned nodesize
+# Invalid: Unaligned sectorsize with aligned nodesize
do_test 8191 16k && _fail
# Valid: Aligned sectorsize and nodesize
* }
* ulist_free(ulist);
*
- * This assumes the graph nodes are adressable by u64. This stems from the
+ * This assumes the graph nodes are addressable by u64. This stems from the
* usage for tree enumeration in btrfs, where the logical addresses are
* 64 bit.
*
return ret;
}
- /* iterate over the list of currently mountes filesystems */
+ /* iterate over the list of currently mounted filesystems */
if ((f = setmntent ("/proc/self/mounts", "r")) == NULL)
return -errno;
}
/*
- * Slot is used to verfy the chunk item is valid
+ * Slot is used to verify the chunk item is valid
*
* For sys chunk in superblock, pass -1 to indicate sys chunk.
*/