From: Ivan Shapovalov <intelfx100@gmail.com>
To: reiserfs-devel@vger.kernel.org
Cc: Ivan Shapovalov <intelfx100@gmail.com>
Subject: [RFC] [PATCHv3 3/5] reiser4: discard support: enable discard functionality through a mount option.
Date: Thu, 8 May 2014 22:45:48 +0400 [thread overview]
Message-ID: <1399574750-10499-4-git-send-email-intelfx100@gmail.com> (raw)
In-Reply-To: <1399574750-10499-1-git-send-email-intelfx100@gmail.com>
Discard subsystem is now enabled conditionally, using "discard" mount option.
For now there is no auto-detection in either direction.
Signed-off-by: Ivan Shapovalov <intelfx100@gmail.com>
---
fs/reiser4/discard.c | 9 +++++++++
fs/reiser4/init_super.c | 2 ++
fs/reiser4/super.h | 4 +++-
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/fs/reiser4/discard.c b/fs/reiser4/discard.c
index 5646a2a..6f082b8 100644
--- a/fs/reiser4/discard.c
+++ b/fs/reiser4/discard.c
@@ -348,6 +348,11 @@ int discard_atom(txn_atom *atom)
struct list_head discard_set, *pos, *next;
struct discard_set_entry *entry, *next_entry;
+ if (!reiser4_is_set(reiser4_get_current_sb(), REISER4_DISCARD)) {
+ spin_unlock_atom(atom);
+ return 0;
+ }
+
if (list_empty(&atom->discard_set)) {
spin_unlock_atom(atom);
return 0;
@@ -398,6 +403,10 @@ extern int discard_set_add_extent(txn_atom *atom,
const reiser4_block_nr *start,
const reiser4_block_nr *len)
{
+ if (!reiser4_is_set(reiser4_get_current_sb(), REISER4_DISCARD)) {
+ return 0;
+ }
+
if (*new_entry == NULL) {
/*
* Optimization: try to merge new extent into the last one.
diff --git a/fs/reiser4/init_super.c b/fs/reiser4/init_super.c
index 620a0f5..1ff8dad 100644
--- a/fs/reiser4/init_super.c
+++ b/fs/reiser4/init_super.c
@@ -494,6 +494,8 @@ int reiser4_init_super_data(struct super_block *super, char *opt_string)
PUSH_BIT_OPT("atomic_write", REISER4_ATOMIC_WRITE);
/* disable use of write barriers in the reiser4 log writer. */
PUSH_BIT_OPT("no_write_barrier", REISER4_NO_WRITE_BARRIER);
+ /* enable issuing of discard requests */
+ PUSH_BIT_OPT("discard", REISER4_DISCARD);
PUSH_OPT(p, opts,
{
diff --git a/fs/reiser4/super.h b/fs/reiser4/super.h
index 0c73845..895c3f3 100644
--- a/fs/reiser4/super.h
+++ b/fs/reiser4/super.h
@@ -51,7 +51,9 @@ typedef enum {
/* enforce atomicity during write(2) */
REISER4_ATOMIC_WRITE = 6,
/* don't use write barriers in the log writer code. */
- REISER4_NO_WRITE_BARRIER = 7
+ REISER4_NO_WRITE_BARRIER = 7,
+ /* enable issuing of discard requests */
+ REISER4_DISCARD = 8
} reiser4_fs_flag;
/*
--
1.9.2
next prev parent reply other threads:[~2014-05-08 18:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-08 18:45 [RFC] [PATCHv3 0/5] reiser4: discard support: initial implementation Ivan Shapovalov
2014-05-08 18:45 ` [RFC] [PATCHv3 1/5] reiser4: discard support: make space_allocator's check_blocks() reusable Ivan Shapovalov
2014-05-08 18:45 ` [RFC] [PATCHv3 2/5] reiser4: discard support: initial implementation using extent lists Ivan Shapovalov
2014-05-08 18:45 ` Ivan Shapovalov [this message]
2014-05-08 18:45 ` [RFC] [PATCHv3 4/5] reiser4: discard support: add assertions to all code written within this feature Ivan Shapovalov
2014-05-08 18:45 ` [RFC] [PATCHv3 5/5] reiser4: discard support: downgrade all reiser4_log() to reiser4_debug() Ivan Shapovalov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399574750-10499-4-git-send-email-intelfx100@gmail.com \
--to=intelfx100@gmail.com \
--cc=reiserfs-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).