From: Miklos Szeredi <miklos@xxxxxxxxxx>
To: akpm@xxxxxxxxxxxxxxxxxxxx
Cc: linux-fsdevel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Subject: [PATCH] consolidate generic_writepages and mpage_writepages
Date: Fri, 16 Feb 2007 17:23:25 +0100
From: Miklos Szeredi <mszeredi@xxxxxxx>
Clean up massive code duplication between mpage_writepages() and
generic_writepages().
The new generic function, write_cache_pages() takes a function pointer
argument, which will be called for each page to be written.
Maybe cifs_writepages() too can use this infrastructure, but I'm not
touching that with a ten-foot pole.
The cifs case ought to be one of the simpler ones, pseudo-code is pretty
easy, the hard part is all of the stuff unrelated to cifs:
Ideally if there were generic functions to help out, cifs writepages
would look roughly like the following
cifs_writepages(struct address_space *mapping, struct writeback_control
*wbc)
{
while (no more pages to write) {
/* find writeable file handle for this inode */
/* find the biggest set of contiguous pages that total less than
wsize */
if (packet signing is enabled)
/* write lock pages so they can not be changed under us
while we are calculating the checksum */
CIFSSMBWrite2(tree_connection, network_file_handle, array of
iovecs, number of iovecs);
if(packet signing was enabled)
/* unlock pages */
if(error) {
set page errors
if (mounted "hard" )
continue; /* retry */
else /* if no retry possible */
return error to caller;
}
update bytes written statistics
update index to point to next set of pages
} /* end while loop */
}
If it were even better, CIFSSMBWrite2 could be called async - so that it
did not have to wait for a network response from Samba (just an ack from
TCP), before issuing the next write onto the wire - but this would
require that we could queue a pointer to a completion routine to the mpx
entry.
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html