GFS2: Allocate reservation during write_begin if needed
PATCH 1/1 GFS2: Allocate reservation during write_begin if needed
In reply to a message not in the archiveHi,
This patch adds a call to function gfs2_rs_alloc to make sure a reservation structure has been allocated before attempting to reserve blocks.
Regards,
Bob Peterson
Red Hat File Systems
--- fs/gfs2/aops.c | 3 +++ 1 file changed, 3 insertions(+)
fs/gfs2/aops.c +3 -0
@@ -675,6 +675,9 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,if (error) goto out_unlock; + error =gfs2_rs_alloc (ip); +if (error) + goto out_qunlock; requested = data_blocks + ind_blocks; ap.target = requested; error =gfs2_inplace_reserve (ip, &ap);
PATCH 1/1 GFS2: Allocate reservation during write_begin if needed
Hi,
Since we set the allocation structure when the write call begins, and it is not deallocated until there are no writers left with the file open, how does this happen?
Steve.
Quoted 31 lines · Bob Peterson
Hi,
This patch adds a call to function
gfs2_rs_allocto make sure a reservation structure has been allocated before attempting to reserve blocks.Regards,
Bob Peterson
Red Hat File SystemsSigned-off-by Bob Peterson <[email protected]>--- fs/gfs2/aops.c | 3 +++ 1 file changed, 3 insertions(+)fs/gfs2/aops.c +3
-0@@ -675,6 +675,9 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,if (error) goto out_unlock; + error =gfs2_rs_alloc (ip); +if (error) + goto out_qunlock; requested = data_blocks + ind_blocks; ap.target = requested; error =gfs2_inplace_reserve (ip, &ap);
PATCH 1/1 GFS2: Allocate reservation during write_begin if needed
----- Original Message -----
Quoted 8 lines
Hi,
Since we set the allocation structure when the write call begins, and it is not deallocated until there are no writers left with the file open, how does this happen?
Steve.
Hi,
In a normal write, the code goes through gfs2_page_mkwrite or gfs2_file_aio_write. In the failing scenario, it's going through sendfile. I suppose I could patch sendfile as an alternative, but the advantage here is that this patch will do it only if a block allocation is needed.
Regards,
Bob Peterson
Red Hat File Systems
PATCH 1/1 GFS2: Allocate reservation during write_begin if needed
Hi,
Quoted 17 lines · Bob Peterson
----- Original Message -----
Quoted 8 lines
Hi,
Since we set the allocation structure when the write call begins, and it is not deallocated until there are no writers left with the file open, how does this happen?
Steve.
Hi,
In a normal write, the code goes through
gfs2_page_mkwriteorgfs2_file_aio_write. In the failing scenario, it's going through sendfile. I suppose I could patch sendfile as an alternative, but the advantage here is that this patch will do it only if a block allocation is needed.
Quoted 4 lines
Regards,
Bob Peterson
Red Hat File Systems
Ah, I see. In which case that code path should be patched. So it should be part of the splice code I think, since it should be done at the higher level, and not at the write_begin level, since that is too late. We should have a call to the reservation code too at that point, to ensure that we don't have fragmentation issues. So we need a wrapper for |iter_file_splice_write| along the lines of gfs2_file_write_iter I think,
Steve.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20150217/5af83d4a/attachment.htm>