Skip to content

Commit 64bc06b

Browse files
author
Andreas Gruenbacher
committed
gfs2: iomap buffered write support
With the traditional page-based writes, blocks are allocated separately for each page written to. With iomap writes, we can allocate a lot more blocks at once, with a fraction of the allocation overhead for each page. Split calculating the number of blocks that can be allocated at a given position (gfs2_alloc_size) off from gfs2_iomap_alloc: that size determines the number of blocks to allocate and reserve in the journal. Signed-off-by: Andreas Gruenbacher <[email protected]> Reviewed-by: Bob Peterson <[email protected]>
1 parent d505a96 commit 64bc06b

File tree

4 files changed

+338
-43
lines changed

4 files changed

+338
-43
lines changed

Diff for: fs/gfs2/aops.c

+11-9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/backing-dev.h>
2323
#include <linux/uio.h>
2424
#include <trace/events/writeback.h>
25+
#include <linux/sched/signal.h>
2526

2627
#include "gfs2.h"
2728
#include "incore.h"
@@ -36,10 +37,11 @@
3637
#include "super.h"
3738
#include "util.h"
3839
#include "glops.h"
40+
#include "aops.h"
3941

4042

41-
static void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page,
42-
unsigned int from, unsigned int len)
43+
void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page,
44+
unsigned int from, unsigned int len)
4345
{
4446
struct buffer_head *head = page_buffers(page);
4547
unsigned int bsize = head->b_size;
@@ -462,7 +464,7 @@ static int gfs2_jdata_writepages(struct address_space *mapping,
462464
* Returns: errno
463465
*/
464466

465-
static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
467+
int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
466468
{
467469
struct buffer_head *dibh;
468470
u64 dsize = i_size_read(&ip->i_inode);
@@ -776,7 +778,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
776778
* adjust_fs_space - Adjusts the free space available due to gfs2_grow
777779
* @inode: the rindex inode
778780
*/
779-
static void adjust_fs_space(struct inode *inode)
781+
void adjust_fs_space(struct inode *inode)
780782
{
781783
struct gfs2_sbd *sdp = inode->i_sb->s_fs_info;
782784
struct gfs2_inode *m_ip = GFS2_I(sdp->sd_statfs_inode);
@@ -822,11 +824,11 @@ static void adjust_fs_space(struct inode *inode)
822824
* This copies the data from the page into the inode block after
823825
* the inode data structure itself.
824826
*
825-
* Returns: errno
827+
* Returns: copied bytes or errno
826828
*/
827-
static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
828-
loff_t pos, unsigned copied,
829-
struct page *page)
829+
int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
830+
loff_t pos, unsigned copied,
831+
struct page *page)
830832
{
831833
struct gfs2_inode *ip = GFS2_I(inode);
832834
u64 to = pos + copied;
@@ -865,7 +867,7 @@ static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
865867
* The main write_end function for GFS2. We just put our locking around the VFS
866868
* provided functions.
867869
*
868-
* Returns: errno
870+
* Returns: copied bytes or errno
869871
*/
870872

871873
static int gfs2_write_end(struct file *file, struct address_space *mapping,

Diff for: fs/gfs2/aops.h

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* Copyright (C) 2018 Red Hat, Inc. All rights reserved.
4+
*/
5+
6+
#ifndef __AOPS_DOT_H__
7+
#define __AOPS_DOT_H__
8+
9+
#include "incore.h"
10+
11+
extern int stuffed_readpage(struct gfs2_inode *ip, struct page *page);
12+
extern int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
13+
loff_t pos, unsigned copied,
14+
struct page *page);
15+
extern void adjust_fs_space(struct inode *inode);
16+
extern void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page,
17+
unsigned int from, unsigned int len);
18+
19+
#endif /* __AOPS_DOT_H__ */

0 commit comments

Comments
 (0)