* [PATCHv5 01/10] reiser4: block_alloc: add BA_SOME_SPACE flag for grabbing a fixed amount of space.
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
@ 2015-02-13 0:48 ` Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 02/10] reiser4: block_alloc: add a "monotonic_forward" parameter to reiser4_blocknr_hint to allocate blocks only in forward direction Ivan Shapovalov
` (10 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 0:48 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Ivan Shapovalov
This is used for FITRIM ioctl which will iteratively grab, allocate and trim disk space
bit by bit to avoid starving the rest of system.
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/block_alloc.c | 22 ++++++++++++++++++----
fs/reiser4/block_alloc.h | 5 ++++-
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/fs/reiser4/block_alloc.c b/fs/reiser4/block_alloc.c
index 324b11c..14dd378 100644
--- a/fs/reiser4/block_alloc.c
+++ b/fs/reiser4/block_alloc.c
@@ -264,7 +264,7 @@ int reiser4_check_block_counters(const struct super_block *super)
static int
reiser4_grab(reiser4_context * ctx, __u64 count, reiser4_ba_flags_t flags)
{
- __u64 free_blocks;
+ __s64 allowed_blocks;
int ret = 0, use_reserved = flags & BA_RESERVED;
reiser4_super_info_data *sbinfo;
@@ -280,10 +280,24 @@ reiser4_grab(reiser4_context * ctx, __u64 count, reiser4_ba_flags_t flags)
spin_lock_reiser4_super(sbinfo);
- free_blocks = sbinfo->blocks_free;
+ allowed_blocks = use_reserved ? sbinfo->blocks_free
+ : sbinfo->blocks_free - sbinfo->blocks_reserved;
- if ((use_reserved && free_blocks < count) ||
- (!use_reserved && free_blocks < count + sbinfo->blocks_reserved)) {
+ if (flags & BA_SOME_SPACE) {
+ /* Reserve 25% of all free space */
+ if (allowed_blocks <= 0) {
+ /* No space at all */
+ ret = RETERR(-ENOSPC);
+ goto unlock_and_ret;
+ }
+
+ count = allowed_blocks >> 2;
+ if (count == 0) {
+ /* Less than 4 free blocks */
+ count = allowed_blocks;
+ }
+ } else if (count > allowed_blocks) {
+ /* Not enough space */
ret = RETERR(-ENOSPC);
goto unlock_and_ret;
}
diff --git a/fs/reiser4/block_alloc.h b/fs/reiser4/block_alloc.h
index a4e98af..bfc6be9 100644
--- a/fs/reiser4/block_alloc.h
+++ b/fs/reiser4/block_alloc.h
@@ -79,7 +79,10 @@ enum reiser4_ba_flags {
BA_FORCE = (1 << 5),
/* use default start value for free blocks search. */
- BA_USE_DEFAULT_SEARCH_START = (1 << 6)
+ BA_USE_DEFAULT_SEARCH_START = (1 << 6),
+
+ /* reserve some fixed amount of space */
+ BA_SOME_SPACE = (1 << 7),
};
typedef enum reiser4_ba_flags reiser4_ba_flags_t;
--
2.3.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCHv5 02/10] reiser4: block_alloc: add a "monotonic_forward" parameter to reiser4_blocknr_hint to allocate blocks only in forward direction.
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 01/10] reiser4: block_alloc: add BA_SOME_SPACE flag for grabbing a fixed amount of space Ivan Shapovalov
@ 2015-02-13 0:48 ` Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 03/10] reiser4: block_alloc: move block accounting by pre-commit hook into block_alloc.c and document BA_DEFER behavior Ivan Shapovalov
` (9 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 0:48 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Ivan Shapovalov
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/block_alloc.c | 4 ++--
fs/reiser4/block_alloc.h | 5 +++--
fs/reiser4/plugin/space/bitmap.c | 10 ++++++----
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/fs/reiser4/block_alloc.c b/fs/reiser4/block_alloc.c
index 14dd378..56795ca 100644
--- a/fs/reiser4/block_alloc.c
+++ b/fs/reiser4/block_alloc.c
@@ -264,7 +264,7 @@ int reiser4_check_block_counters(const struct super_block *super)
static int
reiser4_grab(reiser4_context * ctx, __u64 count, reiser4_ba_flags_t flags)
{
- __s64 allowed_blocks;
+ __u64 allowed_blocks;
int ret = 0, use_reserved = flags & BA_RESERVED;
reiser4_super_info_data *sbinfo;
@@ -285,7 +285,7 @@ reiser4_grab(reiser4_context * ctx, __u64 count, reiser4_ba_flags_t flags)
if (flags & BA_SOME_SPACE) {
/* Reserve 25% of all free space */
- if (allowed_blocks <= 0) {
+ if (allowed_blocks == 0) {
/* No space at all */
ret = RETERR(-ENOSPC);
goto unlock_and_ret;
diff --git a/fs/reiser4/block_alloc.h b/fs/reiser4/block_alloc.h
index bfc6be9..903bc8f 100644
--- a/fs/reiser4/block_alloc.h
+++ b/fs/reiser4/block_alloc.h
@@ -51,9 +51,10 @@ struct reiser4_blocknr_hint {
/* block allocator assumes that blocks, which will be mapped to disk,
are in this specified block_stage */
block_stage_t block_stage;
- /* If direction = 1 allocate blocks in backward direction from the end
- * of disk to the beginning of disk. */
+ /* allocate blocks in backward direction */
unsigned int backward:1;
+ /* allocate blocks only in forward direction starting from blk */
+ unsigned int monotonic_forward:1;
};
diff --git a/fs/reiser4/plugin/space/bitmap.c b/fs/reiser4/plugin/space/bitmap.c
index 3da3f6b..e56c336 100644
--- a/fs/reiser4/plugin/space/bitmap.c
+++ b/fs/reiser4/plugin/space/bitmap.c
@@ -1124,10 +1124,12 @@ static int alloc_blocks_forward(reiser4_blocknr_hint *hint, int needed,
actual_len =
bitmap_alloc_forward(&search_start, &search_end, 1, needed);
- /* There is only one bitmap search if max_dist was specified or first
- pass was from the beginning of the bitmap. We also do one pass for
- scanning bitmap in backward direction. */
- if (!(actual_len != 0 || hint->max_dist != 0 || search_start == 0)) {
+ /* There is only one bitmap search if max_dist was specified, first
+ pass was from the beginning of the bitmap, or if the monotonic flag
+ has been set. Otherwise we also do one pass for scanning bitmap in
+ backward direction. */
+ if (actual_len == 0 && search_start != 0 &&
+ hint->max_dist == 0 && !hint->monotonic_forward) {
/* next step is a scanning from 0 to search_start */
search_end = search_start;
search_start = 0;
--
2.3.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCHv5 03/10] reiser4: block_alloc: move block accounting by pre-commit hook into block_alloc.c and document BA_DEFER behavior.
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 01/10] reiser4: block_alloc: add BA_SOME_SPACE flag for grabbing a fixed amount of space Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 02/10] reiser4: block_alloc: add a "monotonic_forward" parameter to reiser4_blocknr_hint to allocate blocks only in forward direction Ivan Shapovalov
@ 2015-02-13 0:48 ` Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 04/10] reiser4: txnmgr: free allocated but unneeded atom in atom_begin_and_assign_to_txnh() Ivan Shapovalov
` (8 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 0:48 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Ivan Shapovalov
BA_DEFER deallocations ignore target_stage and other flags and use some implied
values for these parameters. Document these values and where they do matter.
Also move deallocated block accounting into block_alloc.c because
1) it is allocator-independent;
2) it allows discard code to rely on that accounting is done in pre-commit hook and
not later, so that discard code should not use BA_PERMANENT in its allocations.
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/block_alloc.c | 44 +++++++++++++++++++++++++++++++++++++++-
fs/reiser4/plugin/space/bitmap.c | 23 ++-------------------
2 files changed, 45 insertions(+), 22 deletions(-)
diff --git a/fs/reiser4/block_alloc.c b/fs/reiser4/block_alloc.c
index 56795ca..549cc0a 100644
--- a/fs/reiser4/block_alloc.c
+++ b/fs/reiser4/block_alloc.c
@@ -998,6 +998,19 @@ reiser4_check_blocks(const reiser4_block_nr * start,
/* BA_FORMATTED bit is only used when BA_DEFER in not present: it is used to
distinguish blocks allocated for unformatted and formatted nodes */
+/* if BA_DEFER is enabled, @target_stage and other @flags are ignored.
+ *
+ * @target_stage is implied to be BLOCK_NOT_COUNTED.
+ * (assumption is used in reiser4_post_write_back_hook() and apply_dset())
+ *
+ * @flags are implied to have BA_PERMANENT.
+ * (assumption is used in reiser4_pre_commit_hook() which counts deallocated
+ * blocks)
+ *
+ * That is, if a deferred deallocation is done after reiser4_pre_commit_hook(),
+ * then BA_PERMANENT is implied to be disabled.
+ */
+
int
reiser4_dealloc_blocks(const reiser4_block_nr * start,
const reiser4_block_nr * len,
@@ -1089,10 +1102,39 @@ reiser4_dealloc_blocks(const reiser4_block_nr * start,
return 0;
}
+/* an actor for counting blocks that are going to be deallocated */
+static int
+count_dset_blocks(txn_atom * atom, const reiser4_block_nr * start,
+ const reiser4_block_nr * len, void *data)
+{
+ reiser4_block_nr *blocks_freed_p = data;
+
+ if (len != NULL) {
+ (*blocks_freed_p) += *len;
+ } else {
+ (*blocks_freed_p)++;
+ }
+ return 0;
+}
+
/* wrappers for block allocator plugin methods */
int reiser4_pre_commit_hook(void)
{
- assert("zam-502", get_current_super_private() != NULL);
+ reiser4_block_nr blocks_freed = 0;
+ reiser4_super_info_data *sbinfo = get_current_super_private();
+ txn_atom *atom = get_current_atom_locked();
+
+ assert("zam-502", sbinfo != NULL);
+
+ assert("zam-876", atom->stage == ASTAGE_PRE_COMMIT);
+ spin_unlock_atom(atom);
+
+ atom_dset_deferred_apply(atom, count_dset_blocks, &blocks_freed, 0);
+
+ spin_lock_reiser4_super(sbinfo);
+ sbinfo->blocks_free_committed += blocks_freed - atom->nr_blocks_allocated;
+ spin_unlock_reiser4_super(sbinfo);
+
sa_pre_commit_hook();
return 0;
}
diff --git a/fs/reiser4/plugin/space/bitmap.c b/fs/reiser4/plugin/space/bitmap.c
index e56c336..0ce07da 100644
--- a/fs/reiser4/plugin/space/bitmap.c
+++ b/fs/reiser4/plugin/space/bitmap.c
@@ -1322,15 +1322,13 @@ static void cond_add_to_overwrite_set(txn_atom * atom, jnode * node)
pages in a single-linked list */
static int
apply_dset_to_commit_bmap(txn_atom * atom, const reiser4_block_nr * start,
- const reiser4_block_nr * len, void *data)
+ const reiser4_block_nr * len, void *data UNUSED_ARG)
{
bmap_nr_t bmap;
bmap_off_t offset;
int ret;
- long long *blocks_freed_p = data;
-
struct bitmap_node *bnode;
struct super_block *sb = reiser4_get_current_sb();
@@ -1366,11 +1364,8 @@ apply_dset_to_commit_bmap(txn_atom * atom, const reiser4_block_nr * start,
assert("zam-443",
offset + *len <= bmap_bit_count(sb->s_blocksize));
reiser4_clear_bits(data, offset, (bmap_off_t) (offset + *len));
-
- (*blocks_freed_p) += *len;
} else {
reiser4_clear_bit(offset, data);
- (*blocks_freed_p)++;
}
bnode_set_commit_crc(bnode, bnode_calc_crc(bnode, sb->s_blocksize));
@@ -1393,8 +1388,6 @@ int reiser4_pre_commit_hook_bitmap(void)
struct super_block *super = reiser4_get_current_sb();
txn_atom *atom;
- long long blocks_freed = 0;
-
atom = get_current_atom_locked();
assert("zam-876", atom->stage == ASTAGE_PRE_COMMIT);
spin_unlock_atom(atom);
@@ -1460,19 +1453,7 @@ int reiser4_pre_commit_hook_bitmap(void)
}
}
- atom_dset_deferred_apply(atom, apply_dset_to_commit_bmap, &blocks_freed, 0);
-
- blocks_freed -= atom->nr_blocks_allocated;
-
- {
- reiser4_super_info_data *sbinfo;
-
- sbinfo = get_super_private(super);
-
- spin_lock_reiser4_super(sbinfo);
- sbinfo->blocks_free_committed += blocks_freed;
- spin_unlock_reiser4_super(sbinfo);
- }
+ atom_dset_deferred_apply(atom, apply_dset_to_commit_bmap, NULL, 0);
return 0;
}
--
2.3.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCHv5 04/10] reiser4: txnmgr: free allocated but unneeded atom in atom_begin_and_assign_to_txnh().
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
` (2 preceding siblings ...)
2015-02-13 0:48 ` [PATCHv5 03/10] reiser4: block_alloc: move block accounting by pre-commit hook into block_alloc.c and document BA_DEFER behavior Ivan Shapovalov
@ 2015-02-13 0:48 ` Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 05/10] reiser4: txnmgr: add reiser4_create_atom() which creates an empty atom without capturing any nodes Ivan Shapovalov
` (7 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 0:48 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Ivan Shapovalov
It is unclear why it hasn't been done before, as there was a
corresponding notice, and such change apparently does not carry any side
effects.
Do this to avoid duplicating code in the next commit.
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/txnmgr.c | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/fs/reiser4/txnmgr.c b/fs/reiser4/txnmgr.c
index d73ecb9..68070a9 100644
--- a/fs/reiser4/txnmgr.c
+++ b/fs/reiser4/txnmgr.c
@@ -709,6 +709,9 @@ static int atom_begin_and_assign_to_txnh(txn_atom ** atom_alloc, txn_handle * tx
return RETERR(-ENOMEM);
}
+ atom = *atom_alloc;
+ *atom_alloc = NULL;
+
/* and, also, txnmgr spin lock should be taken before jnode and txnh
locks. */
mgr = &get_super_private(reiser4_get_current_sb())->tmgr;
@@ -717,18 +720,14 @@ static int atom_begin_and_assign_to_txnh(txn_atom ** atom_alloc, txn_handle * tx
/* Check whether new atom still needed */
if (txnh->atom != NULL) {
- /* NOTE-NIKITA probably it is rather better to free
- * atom_alloc here than thread it up to reiser4_try_capture() */
-
spin_unlock_txnh(txnh);
spin_unlock_txnmgr(mgr);
+ kmem_cache_free(_atom_slab, atom);
+
return -E_REPEAT;
}
- atom = *atom_alloc;
- *atom_alloc = NULL;
-
atom_init(atom);
assert("jmacd-17", atom_isclean(atom));
@@ -2031,15 +2030,6 @@ int reiser4_try_capture(jnode *node, znode_lock_mode lock_mode,
goto repeat;
}
- /* free extra atom object that was possibly allocated by
- try_capture_block().
-
- Do this before acquiring jnode spin lock to
- minimize time spent under lock. --nikita */
- if (atom_alloc != NULL) {
- kmem_cache_free(_atom_slab, atom_alloc);
- }
-
if (ret != 0) {
if (ret == -E_BLOCK) {
assert("nikita-3360",
--
2.3.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCHv5 05/10] reiser4: txnmgr: add reiser4_create_atom() which creates an empty atom without capturing any nodes.
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
` (3 preceding siblings ...)
2015-02-13 0:48 ` [PATCHv5 04/10] reiser4: txnmgr: free allocated but unneeded atom in atom_begin_and_assign_to_txnh() Ivan Shapovalov
@ 2015-02-13 0:48 ` Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 06/10] reiser4: txnmgr: move "empty atom" shortcut slightly below Ivan Shapovalov
` (6 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 0:48 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Ivan Shapovalov
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/txnmgr.c | 24 ++++++++++++++++++++++++
fs/reiser4/txnmgr.h | 2 ++
2 files changed, 26 insertions(+)
diff --git a/fs/reiser4/txnmgr.c b/fs/reiser4/txnmgr.c
index 68070a9..2862940 100644
--- a/fs/reiser4/txnmgr.c
+++ b/fs/reiser4/txnmgr.c
@@ -2050,6 +2050,30 @@ int reiser4_try_capture(jnode *node, znode_lock_mode lock_mode,
return ret;
}
+/* This function ensures that the current transcrash has an atom without
+ * capturing anything. If needed, an empty atom is created and assigned.
+ */
+int reiser4_create_atom(void)
+{
+ txn_atom *atom_alloc = NULL;
+ txn_handle *txnh = get_current_context()->trans;
+ int ret;
+
+ do {
+ spin_lock_txnh(txnh);
+ if (txnh->atom == NULL) {
+ spin_unlock_txnh(txnh);
+ /* assign empty atom to the txnh and repeat */
+ ret = atom_begin_and_assign_to_txnh(&atom_alloc, txnh);
+ } else {
+ spin_unlock_txnh(txnh);
+ ret = 0;
+ }
+ } while (ret == -E_REPEAT);
+
+ return ret;
+}
+
static void release_two_atoms(txn_atom *one, txn_atom *two)
{
spin_unlock_atom(one);
diff --git a/fs/reiser4/txnmgr.h b/fs/reiser4/txnmgr.h
index 72b84a2..50a1f54 100644
--- a/fs/reiser4/txnmgr.h
+++ b/fs/reiser4/txnmgr.h
@@ -437,6 +437,8 @@ extern void reiser4_uncapture_jnode(jnode *);
extern int reiser4_capture_inode(struct inode *);
extern int reiser4_uncapture_inode(struct inode *);
+extern int reiser4_create_atom(void);
+
extern txn_atom *get_current_atom_locked_nocheck(void);
#if REISER4_DEBUG
--
2.3.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCHv5 06/10] reiser4: txnmgr: move "empty atom" shortcut slightly below.
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
` (4 preceding siblings ...)
2015-02-13 0:48 ` [PATCHv5 05/10] reiser4: txnmgr: add reiser4_create_atom() which creates an empty atom without capturing any nodes Ivan Shapovalov
@ 2015-02-13 0:48 ` Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 07/10] reiser4: batch discard support: add a dummy FITRIM ioctl handler for directories Ivan Shapovalov
` (5 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 0:48 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Ivan Shapovalov
reiser4_trim_fs() generate empty (atom->capture_count == 0) atoms which
still have non-empty delete sets. That is, such atoms take a "goto done"
shortcut in commit_current_atom().
First, this shortcut must not preclude calling current_atom_complete_writes()
to process and detach atom's flush queues (otherwise atom_isclean() will
return false).
Second, reiser4_post_write_back_hook() needs to be called explicitly
to process atom's delete sets.
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/txnmgr.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/fs/reiser4/txnmgr.c b/fs/reiser4/txnmgr.c
index 2862940..5084722 100644
--- a/fs/reiser4/txnmgr.c
+++ b/fs/reiser4/txnmgr.c
@@ -1064,9 +1064,6 @@ static int commit_current_atom(long *nr_submitted, txn_atom ** atom)
return RETERR(-E_REPEAT);
}
- if ((*atom)->capture_count == 0)
- goto done;
-
/* Up to this point we have been flushing and after flush is called we
return -E_REPEAT. Now we can commit. We cannot return -E_REPEAT
at this point, commit should be successful. */
@@ -1078,6 +1075,14 @@ static int commit_current_atom(long *nr_submitted, txn_atom ** atom)
if (ret)
return ret;
+ if ((*atom)->capture_count == 0) {
+ /* Process the atom's delete set.
+ * Even if the atom has no captured nodes, the delete set may
+ * still be non-empty (see e. g. reiser4_trim_fs()). */
+ reiser4_post_write_back_hook();
+ goto done;
+ }
+
assert("zam-906", list_empty(ATOM_WB_LIST(*atom)));
/* isolate critical code path which should be executed by only one
@@ -1100,8 +1105,8 @@ static int commit_current_atom(long *nr_submitted, txn_atom ** atom)
reiser4_invalidate_list(ATOM_WB_LIST(*atom));
assert("zam-927", list_empty(&(*atom)->inodes));
+done:
spin_lock_atom(*atom);
- done:
reiser4_atom_set_stage(*atom, ASTAGE_DONE);
ON_DEBUG((*atom)->committer = NULL);
--
2.3.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCHv5 07/10] reiser4: batch discard support: add a dummy FITRIM ioctl handler for directories.
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
` (5 preceding siblings ...)
2015-02-13 0:48 ` [PATCHv5 06/10] reiser4: txnmgr: move "empty atom" shortcut slightly below Ivan Shapovalov
@ 2015-02-13 0:48 ` Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 08/10] reiser4: batch discard support: actually implement the FITRIM ioctl handler Ivan Shapovalov
` (4 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 0:48 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Ivan Shapovalov
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/plugin/dir/dir.h | 2 ++
fs/reiser4/plugin/file_ops.c | 27 +++++++++++++++++++++++++++
fs/reiser4/plugin/object.c | 6 +++++-
3 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/fs/reiser4/plugin/dir/dir.h b/fs/reiser4/plugin/dir/dir.h
index 4a91ebe..5eb7bda 100644
--- a/fs/reiser4/plugin/dir/dir.h
+++ b/fs/reiser4/plugin/dir/dir.h
@@ -10,6 +10,8 @@
#include <linux/fs.h>*/
+long reiser4_ioctl_dir_common(struct file *file, unsigned int cmd, unsigned long arg);
+
/* declarations of functions implementing HASHED_DIR_PLUGIN_ID dir plugin */
/* "hashed" directory methods of dir plugin */
diff --git a/fs/reiser4/plugin/file_ops.c b/fs/reiser4/plugin/file_ops.c
index 466da64..64bcdc0 100644
--- a/fs/reiser4/plugin/file_ops.c
+++ b/fs/reiser4/plugin/file_ops.c
@@ -107,6 +107,33 @@ int reiser4_sync_file_common(struct file *file, loff_t start, loff_t end, int da
return 0;
}
+/** reiser4_ioctl_dir_common - ioctl of struct file_operations for typical directory
+ */
+long reiser4_ioctl_dir_common(struct file *file, unsigned int cmd, unsigned long arg)
+{
+ struct inode *inode = file_inode(file);
+ struct super_block *super = inode->i_sb;
+ reiser4_context *ctx;
+ int ret;
+
+ ctx = reiser4_init_context(super);
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
+
+ switch (cmd) {
+ case FITRIM:
+ warning("intelfx-62", "FITRIM ioctl not implemented");
+ /* fall-through to -ENOTTY */
+
+ default:
+ ret = RETERR(-ENOTTY);
+ break;
+ }
+
+ reiser4_exit_context(ctx);
+ return ret;
+}
+
/*
* Local variables:
* c-indentation-style: "K&R"
diff --git a/fs/reiser4/plugin/object.c b/fs/reiser4/plugin/object.c
index 553f1e2..ce09a8a 100644
--- a/fs/reiser4/plugin/object.c
+++ b/fs/reiser4/plugin/object.c
@@ -251,7 +251,11 @@ static struct file_operations directory_f_ops = {
.read = generic_read_dir,
.iterate = reiser4_iterate_common,
.release = reiser4_release_dir_common,
- .fsync = reiser4_sync_common
+ .fsync = reiser4_sync_common,
+#ifdef CONFIG_COMPAT
+ .compat_ioctl = reiser4_ioctl_dir_common,
+#endif
+ .unlocked_ioctl = reiser4_ioctl_dir_common
};
static struct address_space_operations directory_a_ops = {
.writepage = writepage_bugop,
--
2.3.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCHv5 08/10] reiser4: batch discard support: actually implement the FITRIM ioctl handler.
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
` (6 preceding siblings ...)
2015-02-13 0:48 ` [PATCHv5 07/10] reiser4: batch discard support: add a dummy FITRIM ioctl handler for directories Ivan Shapovalov
@ 2015-02-13 0:48 ` Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 09/10] reiser4: block_alloc: add a "min_len" parameter to reiser4_blocknr_hint to limit allocated extent length from below Ivan Shapovalov
` (3 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 0:48 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Ivan Shapovalov
It works in an iterative way, grabbing some fixed amount of space and allocating
blocks until grabbed space is exhausted or partition's end is reached.
Blocks are scheduled for discard by allocating them and immediately adding them
to the atom's delete set, which is read and processed at atom commit time.
After reaching the allocation stop condition, the atom is force-committed and,
if the allocation has been stopped due to grabbed space exhaustion (not due to
reaching end of partition), another iteration happens.
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/plugin/file_ops.c | 41 ++++++++++++-
fs/reiser4/super_ops.c | 135 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 173 insertions(+), 3 deletions(-)
diff --git a/fs/reiser4/plugin/file_ops.c b/fs/reiser4/plugin/file_ops.c
index 64bcdc0..5f0d374 100644
--- a/fs/reiser4/plugin/file_ops.c
+++ b/fs/reiser4/plugin/file_ops.c
@@ -8,6 +8,9 @@
#include "../inode.h"
#include "object.h"
+#include <linux/fs.h>
+#include <linux/blkdev.h>
+
/* file operations */
/* implementation of vfs's llseek method of struct file_operations for
@@ -20,6 +23,9 @@ loff_t reiser4_llseek_dir_common(struct file *, loff_t, int origin);
*/
int reiser4_iterate_common(struct file *, struct dir_context *);
+/* this function is implemented in super_ops.c */
+int reiser4_trim_fs(struct super_block *super, struct fstrim_range* range);
+
/**
* reiser4_release_dir_common - release of struct file_operations
* @inode: inode of released file
@@ -121,9 +127,38 @@ long reiser4_ioctl_dir_common(struct file *file, unsigned int cmd, unsigned long
return PTR_ERR(ctx);
switch (cmd) {
- case FITRIM:
- warning("intelfx-62", "FITRIM ioctl not implemented");
- /* fall-through to -ENOTTY */
+ case FITRIM: {
+ struct request_queue *q = bdev_get_queue(super->s_bdev);
+ struct fstrim_range range;
+
+ if (!capable(CAP_SYS_ADMIN)) {
+ ret = RETERR(-EPERM);
+ break;
+ }
+
+ if (!blk_queue_discard(q)) {
+ ret = RETERR(-EOPNOTSUPP);
+ break;
+ }
+
+ if (copy_from_user(&range, (struct fstrim_range __user *)arg,
+ sizeof(range))) {
+ ret = RETERR(-EFAULT);
+ break;
+ }
+
+ range.minlen = max((unsigned int)range.minlen,
+ q->limits.discard_granularity);
+
+ ret = reiser4_trim_fs(super, &range);
+
+ if (copy_to_user((struct fstrim_range __user *)arg, &range,
+ sizeof(range))) {
+ ret = RETERR(-EFAULT);
+ }
+
+ break;
+ }
default:
ret = RETERR(-ENOTTY);
diff --git a/fs/reiser4/super_ops.c b/fs/reiser4/super_ops.c
index acff93a..ab32ce4 100644
--- a/fs/reiser4/super_ops.c
+++ b/fs/reiser4/super_ops.c
@@ -477,6 +477,141 @@ static int reiser4_show_options(struct seq_file *m, struct dentry *dentry)
return 0;
}
+/**
+ * reiser4_trim_fs - discards all free space in a filesystem
+ * @super: the superblock of filesystem to discard
+ * @range: parameters for discarding
+ *
+ * Called from @reiser4_ioctl_dir_common().
+ */
+int reiser4_trim_fs(struct super_block *super, struct fstrim_range* range)
+{
+ reiser4_blocknr_hint hint;
+ reiser4_block_nr start, end, len, minlen, discarded_count = 0;
+ reiser4_context *ctx;
+ txn_atom *atom;
+ int ret, finished = 0;
+
+ reiser4_blocknr_hint_init(&hint);
+ ctx = get_current_context();
+
+ /*
+ * Configure the hint for block allocator.
+ * We will allocate in forward direction only.
+ */
+ hint.blk = range->start >> super->s_blocksize_bits;
+ hint.max_dist = range->len >> super->s_blocksize_bits;
+ hint.block_stage = BLOCK_GRABBED;
+ hint.monotonic_forward = 1;
+
+ end = hint.blk + hint.max_dist;
+ minlen = range->minlen >> super->s_blocksize_bits;
+
+ /*
+ * We will perform the process in iterations in order not to starve
+ * the rest of the system of disk space.
+ * Each iteration we will grab some space (using the BA_SOME_SPACE
+ * flag, which currently grabs 25% of free disk space), create an empty
+ * atom and sequentially allocate extents of disk space while we can
+ * afford it (i. e. while we haven't reached the end of partition AND
+ * while we haven't exhausted the grabbed space).
+ */
+ do {
+ /*
+ * Grab some sane amount of space.
+ * We will allocate blocks until end of the partition or until
+ * the grabbed space is exhausted.
+ */
+ ret = reiser4_grab_reserved(super, 0, BA_CAN_COMMIT | BA_SOME_SPACE);
+ if (ret != 0)
+ goto out;
+ if (ctx->grabbed_blocks == 0)
+ goto out;
+
+ /*
+ * We will not capture anything, so we need an empty atom.
+ */
+ ret = reiser4_create_atom();
+ if (ret != 0)
+ goto out;
+
+ do {
+ /*
+ * Allocate no more than is grabbed.
+ * FIXME: use minlen.
+ *
+ * NOTE: we do not use BA_PERMANENT in our allocations
+ * even though we deallocate with BA_DEFER.
+ * Our atom takes the "shortcut" in commit_current_atom()
+ * and as such the pre-commit hook is not applied.
+ */
+ assert("intelfx-75", ctx->grabbed_blocks != 0);
+ len = ctx->grabbed_blocks;
+ ret = reiser4_alloc_blocks(&hint, &start, &len, 0 /* flags */);
+ if (ret == -ENOSPC) {
+ /*
+ * We have reached the end of the filesystem --
+ * no more blocks to discard.
+ */
+ ret = 0;
+ finished = 1;
+ break;
+ }
+ if (ret != 0)
+ goto out;
+
+ /*
+ * Update the hint in order for the next scan to start
+ * right after the newly allocated extent.
+ */
+ hint.blk = start + len;
+ hint.max_dist = end - hint.blk;
+
+ /*
+ * Mark the newly allocated extent for deallocation.
+ * Discard happens on deallocation.
+ */
+ ret = reiser4_dealloc_blocks(&start, &len, 0, BA_DEFER);
+ if (ret != 0)
+ goto out;
+
+ /*
+ * FIXME: get the actual discarded block count,
+ * accounting for speculative discard of extent heads and tails.
+ *
+ * PRIORITY: LOW because we have already allocated all
+ * possible space, so allocations of heads/tails will
+ * fail unless there is a concurrent process reclaiming
+ * space.
+ */
+ discarded_count += len;
+ } while (ctx->grabbed_blocks != 0);
+
+ assert("intelfx-64", ret == 0);
+
+ /*
+ * Extents marked for deallocation are discarded here, as part
+ * of committing current atom.
+ */
+ all_grabbed2free();
+ atom = get_current_atom_locked();
+ spin_lock_txnh(ctx->trans);
+ force_commit_atom(ctx->trans);
+ grab_space_enable();
+ } while (!finished);
+
+out:
+ reiser4_release_reserved(super);
+ reiser4_blocknr_hint_done(&hint);
+
+ /*
+ * Update the statistics.
+ */
+ range->len = discarded_count << super->s_blocksize_bits;
+
+ return ret;
+}
+
struct super_operations reiser4_super_operations = {
.alloc_inode = reiser4_alloc_inode,
.destroy_inode = reiser4_destroy_inode,
--
2.3.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCHv5 09/10] reiser4: block_alloc: add a "min_len" parameter to reiser4_blocknr_hint to limit allocated extent length from below.
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
` (7 preceding siblings ...)
2015-02-13 0:48 ` [PATCHv5 08/10] reiser4: batch discard support: actually implement the FITRIM ioctl handler Ivan Shapovalov
@ 2015-02-13 0:48 ` Ivan Shapovalov
2015-02-13 0:48 ` [PATCHv5 10/10] reiser4: batch discard support: honor minimal extent length passed from the userspace Ivan Shapovalov
` (2 subsequent siblings)
11 siblings, 0 replies; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 0:48 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Ivan Shapovalov
The default has been 1, that is, the first encountered free extent with any length
from 1 to requested is allocated and returned.
So, allow changing minimal extent length to allocate.
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/block_alloc.h | 2 ++
fs/reiser4/plugin/space/bitmap.c | 20 +++++++++++++++-----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/fs/reiser4/block_alloc.h b/fs/reiser4/block_alloc.h
index 903bc8f..ac1a747 100644
--- a/fs/reiser4/block_alloc.h
+++ b/fs/reiser4/block_alloc.h
@@ -45,6 +45,8 @@ struct reiser4_blocknr_hint {
reiser4_block_nr blk;
/* if not zero, it is a region size we search for free blocks in */
reiser4_block_nr max_dist;
+ /* if not zero, minimal length of an extent to allocate */
+ reiser4_block_nr min_len;
/* level for allocation, may be useful have branch-level and higher
write-optimized. */
tree_level level;
diff --git a/fs/reiser4/plugin/space/bitmap.c b/fs/reiser4/plugin/space/bitmap.c
index 0ce07da..7c0a1e4 100644
--- a/fs/reiser4/plugin/space/bitmap.c
+++ b/fs/reiser4/plugin/space/bitmap.c
@@ -1101,7 +1101,7 @@ static int alloc_blocks_forward(reiser4_blocknr_hint *hint, int needed,
reiser4_block_nr *start, reiser4_block_nr *len)
{
struct super_block *super = get_current_context()->super;
- int actual_len;
+ int min_len, actual_len;
reiser4_block_nr search_start;
reiser4_block_nr search_end;
@@ -1117,12 +1117,17 @@ static int alloc_blocks_forward(reiser4_blocknr_hint *hint, int needed,
LIMIT(hint->blk + hint->max_dist,
reiser4_block_count(super));
+ if (hint->min_len == 0)
+ min_len = 1;
+ else
+ min_len = (int)hint->min_len;
+
/* We use @hint -> blk as a search start and search from it to the end
of the disk or in given region if @hint -> max_dist is not zero */
search_start = hint->blk;
actual_len =
- bitmap_alloc_forward(&search_start, &search_end, 1, needed);
+ bitmap_alloc_forward(&search_start, &search_end, min_len, needed);
/* There is only one bitmap search if max_dist was specified, first
pass was from the beginning of the bitmap, or if the monotonic flag
@@ -1134,7 +1139,7 @@ static int alloc_blocks_forward(reiser4_blocknr_hint *hint, int needed,
search_end = search_start;
search_start = 0;
actual_len =
- bitmap_alloc_forward(&search_start, &search_end, 1, needed);
+ bitmap_alloc_forward(&search_start, &search_end, min_len, needed);
}
if (actual_len == 0)
return RETERR(-ENOSPC);
@@ -1151,7 +1156,7 @@ static int alloc_blocks_backward(reiser4_blocknr_hint * hint, int needed,
{
reiser4_block_nr search_start;
reiser4_block_nr search_end;
- int actual_len;
+ int min_len, actual_len;
ON_DEBUG(struct super_block *super = reiser4_get_current_sb());
@@ -1165,8 +1170,13 @@ static int alloc_blocks_backward(reiser4_blocknr_hint * hint, int needed,
else
search_end = search_start - hint->max_dist;
+ if (hint->min_len == 0)
+ min_len = 1;
+ else
+ min_len = (int)hint->min_len;
+
actual_len =
- bitmap_alloc_backward(&search_start, &search_end, 1, needed);
+ bitmap_alloc_backward(&search_start, &search_end, min_len, needed);
if (actual_len == 0)
return RETERR(-ENOSPC);
if (actual_len < 0)
--
2.3.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCHv5 10/10] reiser4: batch discard support: honor minimal extent length passed from the userspace.
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
` (8 preceding siblings ...)
2015-02-13 0:48 ` [PATCHv5 09/10] reiser4: block_alloc: add a "min_len" parameter to reiser4_blocknr_hint to limit allocated extent length from below Ivan Shapovalov
@ 2015-02-13 0:48 ` Ivan Shapovalov
2015-02-13 2:11 ` When is the patch set included in the reiser4-for-3.x... release ? doiggl
2015-02-13 9:39 ` [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
11 siblings, 0 replies; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 0:48 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Ivan Shapovalov
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/super_ops.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/fs/reiser4/super_ops.c b/fs/reiser4/super_ops.c
index ab32ce4..2c98959 100644
--- a/fs/reiser4/super_ops.c
+++ b/fs/reiser4/super_ops.c
@@ -487,7 +487,7 @@ static int reiser4_show_options(struct seq_file *m, struct dentry *dentry)
int reiser4_trim_fs(struct super_block *super, struct fstrim_range* range)
{
reiser4_blocknr_hint hint;
- reiser4_block_nr start, end, len, minlen, discarded_count = 0;
+ reiser4_block_nr start, end, len, discarded_count = 0;
reiser4_context *ctx;
txn_atom *atom;
int ret, finished = 0;
@@ -501,11 +501,11 @@ int reiser4_trim_fs(struct super_block *super, struct fstrim_range* range)
*/
hint.blk = range->start >> super->s_blocksize_bits;
hint.max_dist = range->len >> super->s_blocksize_bits;
+ hint.min_len = range->minlen >> super->s_blocksize_bits;
hint.block_stage = BLOCK_GRABBED;
hint.monotonic_forward = 1;
end = hint.blk + hint.max_dist;
- minlen = range->minlen >> super->s_blocksize_bits;
/*
* We will perform the process in iterations in order not to starve
@@ -538,7 +538,6 @@ int reiser4_trim_fs(struct super_block *super, struct fstrim_range* range)
do {
/*
* Allocate no more than is grabbed.
- * FIXME: use minlen.
*
* NOTE: we do not use BA_PERMANENT in our allocations
* even though we deallocate with BA_DEFER.
--
2.3.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* When is the patch set included in the reiser4-for-3.x... release ?
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
` (9 preceding siblings ...)
2015-02-13 0:48 ` [PATCHv5 10/10] reiser4: batch discard support: honor minimal extent length passed from the userspace Ivan Shapovalov
@ 2015-02-13 2:11 ` doiggl
2015-02-13 3:01 ` Ivan Shapovalov
2015-02-13 9:39 ` [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
11 siblings, 1 reply; 15+ messages in thread
From: doiggl @ 2015-02-13 2:11 UTC (permalink / raw)
To: Ivan Shapovalov; +Cc: reiserfs-devel
Hello.
- When is the patch set [1] included in the reiser4-for-3.x... release ?
- Do all the 10 patches go in at the one time ?
--Glenn
[1]
[PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial
implementation.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: When is the patch set included in the reiser4-for-3.x... release ?
2015-02-13 2:11 ` When is the patch set included in the reiser4-for-3.x... release ? doiggl
@ 2015-02-13 3:01 ` Ivan Shapovalov
2015-02-13 5:08 ` help with testing doiggl
0 siblings, 1 reply; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 3:01 UTC (permalink / raw)
To: doiggl; +Cc: reiserfs-devel
[-- Attachment #1: Type: text/plain, Size: 569 bytes --]
On 2015-02-13 at 13:11 +1100, doiggl@velocitynet.com.au wrote:
> Hello.
> - When is the patch set [1] included in the reiser4-for-3.x... release ?
Hello,
this patchset is not yet included in any of the releases. I have just
sent it for a review.
It is to be applied on top of any recent reiser4 patch, if you want to
help with testing.
> - Do all the 10 patches go in at the one time ?
Yes, they do not make much sense without each other. The latter ones
depend on the former ones, so they are applied in order.
--
Ivan Shapovalov / intelfx /
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 213 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* help with testing
2015-02-13 3:01 ` Ivan Shapovalov
@ 2015-02-13 5:08 ` doiggl
0 siblings, 0 replies; 15+ messages in thread
From: doiggl @ 2015-02-13 5:08 UTC (permalink / raw)
To: reiserfs-devel; +Cc: Ivan Shapovalov, edward.shishkin
Hello,
Regards "if you want to help with testing."
I could help with tests after a r4 partition/disk is recovered, using
#fsck.reiser4 --build-fs /dev/sdb
-But I need a patch to fix this problem first [see below]
--Cheers Glenn
--------------
Details:
--------
# fsck.reiser4 --build-fs --force /dev/sdb
.
.
>> LOOKING FOR UNCONNECTED NODES
>>
>> FSCK: node.c: 108: repair_node_items_check: Node (43828275), items (0)
>> and
>> (1): Wrong order of keys.
>> FSCK: node.c: 108: repair_node_items_check: Node (52697435), items (79)
>> and (80): Wrong order of keys.
>> FSCK: node.c: 108: repair_node_items_check: Node (63227569), items (24)
>> and (25): Wrong order of keys.
>> FSCK: node.c: 108: repair_node_items_check: Node (63227571), items (73)
>> and (74): Wrong order of keys.
>> FSCK: node.c: 108: repair_node_items_check: Node (116595727), items
(20)
>> and (21): Wrong order of keys.
>> FSCK: node.c: 108: repair_node_items_check: Node (227923161), items
(22)
>> and (23): Wrong order of keys.
>> FSCK: node.c: 108: repair_node_items_check: Node (284305753), items
(61)
>> and (62): Wrong order of keys.
>> Read nodes 1481038
>>
>> Good nodes 471512
>> Leaves of them 466164, Twigs of them 5348
>> Time interval: Wed Aug 27 03:35:57 2014 - Wed Aug 27 03:39:46
>> 2014
>>
>> ***** fsck.reiser4 finished at Wed Aug 27 03:39:46 2014
>> Closing fs...done
>>
>> FS is consistent.
>
>
> This is a bug in fsck: it jumps to wrong branch for some reasons.
> Not yet fixed.
>
> Edward.
> --
other info:
-----------
# fsck.reiser4 --print-profile /dev/sdb
Default profile:
create: "ccreg40" (id:0x4 type:0x0) [Regular file
plugin for creat(2)]
key: "key_large" (id:0x1 type:0xb) [Key plugin]
compress: "lzo1" (id:0x0 type:0xc) [Compression
plugin]
compressMode: "conv" (id:0x4 type:0xd) [Compression Mode
plugin]
cluster: "64K" (id:0x0 type:0x10) [Cluster plugin]
hash: "r5_hash" (id:0x1 type:0x3) [Directory entry
hash plugin]
fibration: "ext_1_fibre" (id:0x2 type:0x4) [Key fibration
plugin]
formatting: "smart" (id:0x2 type:0x5) [File body
formatting plugin]
reiser4progs-1.0.9 # find . |sort |grep -i fsck
./doc/fsck.reiser4.8
./progs/fsck
./progs/fsck/Makefile.am
./progs/fsck/Makefile.in
./progs/fsck/backup.c
./progs/fsck/backup.h
./progs/fsck/fsck.c
./progs/fsck/fsck.h
# which fsck.reiser4
/usr/sbin/fsck.reiser4
# rpm -qlp reiser4progs-1.0.9-1.2.x86_64.rpm
/usr/sbin/debugfs.reiser4
/usr/sbin/fsck.reiser4
/usr/sbin/make_reiser4
/usr/sbin/measurefs.reiser4
/usr/sbin/mkfs.reiser4
/usr/share/doc/packages/reiser4progs
/usr/share/doc/packages/reiser4progs/BUGS
/usr/share/doc/packages/reiser4progs/COPYING
/usr/share/doc/packages/reiser4progs/ChangeLog
/usr/share/doc/packages/reiser4progs/NEWS
/usr/share/doc/packages/reiser4progs/README
/usr/share/doc/packages/reiser4progs/TODO
/usr/share/man/man8/debugfs.reiser4.8.gz
/usr/share/man/man8/fsck.reiser4.8.gz
/usr/share/man/man8/measurefs.reiser4.8.gz
/usr/share/man/man8/mkfs.reiser4.8.gz
--installation
# rpm -ivhU reiser4progs-1.0.9-1.2.x86_64.rpm
# r4 partition recovery /dev/sdb
http://www.spinics.net/lists/reiserfs-devel/msg04596.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation.
2015-02-13 0:48 [PATCHv5 00/10] reiser4: batch discard support (FITRIM ioctl): initial implementation Ivan Shapovalov
` (10 preceding siblings ...)
2015-02-13 2:11 ` When is the patch set included in the reiser4-for-3.x... release ? doiggl
@ 2015-02-13 9:39 ` Ivan Shapovalov
11 siblings, 0 replies; 15+ messages in thread
From: Ivan Shapovalov @ 2015-02-13 9:39 UTC (permalink / raw)
To: reiserfs-devel
[-- Attachment #1: Type: text/plain, Size: 1559 bytes --]
On 2015-02-13 at 03:48 +0300, Ivan Shapovalov wrote:
> [...]
>
> Ivan Shapovalov (10):
> reiser4: block_alloc: add BA_SOME_SPACE flag for grabbing a fixed amount of space.
> reiser4: block_alloc: add a "monotonic_forward" parameter to reiser4_blocknr_hint to allocate blocks only in forward direction.
> reiser4: block_alloc: move block accounting by pre-commit hook into block_alloc.c and document BA_DEFER behavior.
> reiser4: txnmgr: free allocated but unneeded atom in atom_begin_and_assign_to_txnh().
> reiser4: txnmgr: add reiser4_create_atom() which creates an empty atom without capturing any nodes.
> reiser4: txnmgr: move "empty atom" shortcut slightly below.
> reiser4: batch discard support: add a dummy FITRIM ioctl handler for directories.
> reiser4: batch discard support: actually implement the FITRIM ioctl handler.
> reiser4: block_alloc: add a "min_len" parameter to reiser4_blocknr_hint to limit allocated extent length from below.
> reiser4: batch discard support: honor minimal extent length passed from the userspace.
>
> [...]
This is a diff between v4 and v5, for ease of reviewing.
diff --git a/fs/reiser4/plugin/file_ops.c b/fs/reiser4/plugin/file_ops.c
index 7686406..5f0d374 100644
--- a/fs/reiser4/plugin/file_ops.c
+++ b/fs/reiser4/plugin/file_ops.c
@@ -161,7 +161,7 @@ long reiser4_ioctl_dir_common(struct file *file, unsigned int cmd, unsigned long
}
default:
- ret = RETERR(-ENOSYS);
+ ret = RETERR(-ENOTTY);
break;
}
--
Ivan Shapovalov / intelfx /
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 213 bytes --]
^ permalink raw reply related [flat|nested] 15+ messages in thread