public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* Approach to quickly zeroing large XFS file (or) tool to mark XFS file extents as written
@ 2024-12-23 16:42 Sai Chaitanya Mitta
  2024-12-23 21:53 ` Darrick J. Wong
  2024-12-24  3:42 ` Dave Chinner
  0 siblings, 2 replies; 10+ messages in thread
From: Sai Chaitanya Mitta @ 2024-12-23 16:42 UTC (permalink / raw)
  To: linux-xfs

Hi Team,
           Is there any method/tool available to explicitly mark XFS
file extents as written? One approach I
am aware is explicitly zeroing the entire file (this file may be even
in hundreds of GB in size) through
synchronous/asynchronous(aio/io_uring) mechanism but it is time taking
process for large files,
is there any optimization/approach we can do to explicitly zeroing
file/mark extents as written?


Synchronous Approach:
                    while offset < size {
                        let bytes_written = img_file
                            .write_at(&buf, offset)
                            .map_err(|e| {
                                error!("Failed to zero out file: {}
error: {:?}", vol_name, e);
                            })?;
                        if offset == size {
                            break;
                        }
                        offset = offset + bytes_written as u64;
                    }
                    img_file.sync_all();

Asynchronous approach:
                   Currently used fio with libaio as ioengine but
results are almost same.

-- 
Thanks& Regards,
M.Sai Chaithanya.

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

end of thread, other threads:[~2025-01-07 22:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-23 16:42 Approach to quickly zeroing large XFS file (or) tool to mark XFS file extents as written Sai Chaitanya Mitta
2024-12-23 21:53 ` Darrick J. Wong
2024-12-24  5:47   ` Sai Chaitanya Mitta
2025-01-06 19:46     ` Darrick J. Wong
2025-01-07  6:14       ` Christoph Hellwig
2025-01-07  7:04         ` Darrick J. Wong
2025-01-07  8:37           ` Christoph Hellwig
2025-01-07 22:11             ` Darrick J. Wong
2024-12-24  3:42 ` Dave Chinner
2025-01-06 11:15   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox