All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ext4: stop issuing discards if not supported by device
@ 2010-03-10 16:54 Eric Sandeen
  2010-04-08  0:58 ` tytso
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2010-03-10 16:54 UTC (permalink / raw)
  To: ext4 development

Turn off issuance of discard requests if the device does
not support it - similar to the action we take for barriers.
This will save a little computation time if a non-discardable
device is mounted with -o discard, and also makes it obvious
that it's not doing what was asked at mount time ...

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 506713a..6ee4cac 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2556,6 +2556,7 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)
 		}
 		ext4_unlock_group(sb, entry->group);
 		if (test_opt(sb, DISCARD)) {
+			int ret;
 			ext4_fsblk_t discard_block;
 
 			discard_block = entry->start_blk +
@@ -2563,7 +2564,12 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)
 			trace_ext4_discard_blocks(sb,
 					(unsigned long long)discard_block,
 					entry->count);
-			sb_issue_discard(sb, discard_block, entry->count);
+			ret = sb_issue_discard(sb, discard_block, entry->count);
+			if (ret == EOPNOTSUPP) {
+				ext4_warning(sb,
+					"discard not supported, disabling");
+				clear_opt(EXT4_SB(sb)->s_mount_opt, DISCARD);
+			}
 		}
 		kmem_cache_free(ext4_free_ext_cachep, entry);
 		ext4_mb_release_desc(&e4b);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: stop issuing discards if not supported by device
  2010-03-10 16:54 [PATCH] ext4: stop issuing discards if not supported by device Eric Sandeen
@ 2010-04-08  0:58 ` tytso
  0 siblings, 0 replies; 2+ messages in thread
From: tytso @ 2010-04-08  0:58 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: ext4 development

On Wed, Mar 10, 2010 at 10:54:03AM -0600, Eric Sandeen wrote:
> Turn off issuance of discard requests if the device does
> not support it - similar to the action we take for barriers.
> This will save a little computation time if a non-discardable
> device is mounted with -o discard, and also makes it obvious
> that it's not doing what was asked at mount time ...
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Added to the ext4 patch queue, thanks.

					- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-08  0:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-10 16:54 [PATCH] ext4: stop issuing discards if not supported by device Eric Sandeen
2010-04-08  0:58 ` tytso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.