lkml.org 
[lkml]   [2007]   [Feb]   [17]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [Fwd: [PATCH] consolidate generic_writepages and mpage_writepages]
FromMiklos Szeredi <>
DateSat, 17 Feb 2007 11:04:12 +0100
> >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 */
> }

write_cache_pages() now takes care of the 

     while (no more pages to write) {
     }
part.  All you have to do is to make the body of the loop into a
function and pass it a structure with the data you want to preserve
between invocations.

The hard part is untangling the breaks and continues.

Miklos
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-02-17 11:19    [from the cache]
©2003-2008