linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* XFS discards more data than it writes
@ 2016-08-27  1:45 Jun He
  2016-08-27 22:55 ` Dave Chinner
  0 siblings, 1 reply; 2+ messages in thread
From: Jun He @ 2016-08-27  1:45 UTC (permalink / raw)
  To: xfs

Hi all,

I find that, with '-o discard', XFS sometimes discards more data than it
writes. This may slow down XFS more on slow-discard SSDs. Also, could
problematic discard implementation lead to data loss?

Setup to reproduce: 
- Linux 4.5.4
- Workload: LevelDB

$ mkfs.xfs  -K -f -s size=4096 -b size=4096 /dev/sdc1
$ mount -o discard /dev/sdc1 /mnt/fsonloop
$ leveldb/db_bench --benchmarks=overwrite --num=3000000 --db=/mnt/fsonloop/leveldb_data0 --threads=1 --use_existing_db=0

I found that XFS discarded ~2.4GB while only wrote ~1.4GB,
by blktrace. (This is not due to the mkfs discarding the
whole disk.)

Some visual https://github.com/junhe/xfs-bug-report/blob/master/xfs-double-discard.png 
Some spaces are discarded twice in this case.

Is it a bug?

Thanks,
Jun


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

* Re: XFS discards more data than it writes
  2016-08-27  1:45 XFS discards more data than it writes Jun He
@ 2016-08-27 22:55 ` Dave Chinner
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2016-08-27 22:55 UTC (permalink / raw)
  To: Jun He; +Cc: xfs

On Fri, Aug 26, 2016 at 08:45:37PM -0500, Jun He wrote:
> Hi all,
> 
> I find that, with '-o discard', XFS sometimes discards more data than it
> writes. This may slow down XFS more on slow-discard SSDs. Also, could
> problematic discard implementation lead to data loss?
> 
> Setup to reproduce: 
> - Linux 4.5.4
> - Workload: LevelDB
> 
> $ mkfs.xfs  -K -f -s size=4096 -b size=4096 /dev/sdc1
> $ mount -o discard /dev/sdc1 /mnt/fsonloop
> $ leveldb/db_bench --benchmarks=overwrite --num=3000000 --db=/mnt/fsonloop/leveldb_data0 --threads=1 --use_existing_db=0
> 
> I found that XFS discarded ~2.4GB while only wrote ~1.4GB,
> by blktrace. (This is not due to the mkfs discarding the
> whole disk.)

Yup. Discard covers extents being freed, not ranges being written.
So there's metadata, preallocated (unwritten) regions, speculative
prealloc beyond EOF, etc, all of which won't be counted in "writes"
but will be counted in "discards".

> Some visual https://github.com/junhe/xfs-bug-report/blob/master/xfs-double-discard.png 
> Some spaces are discarded twice in this case.
> 
> Is it a bug?

No.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

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

end of thread, other threads:[~2016-08-27 22:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-27  1:45 XFS discards more data than it writes Jun He
2016-08-27 22:55 ` Dave Chinner

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).