LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: [Fwd: [PATCH] consolidate generic_writepages and mpage_writepages]
       [not found] <1171647615.8468.14.camel@kleikamp.austin.ibm.com>
@ 2007-02-16 23:15 ` Steve French (smfltc)
  2007-02-17 10:04   ` Miklos Szeredi
  0 siblings, 1 reply; 2+ messages in thread
From: Steve French (smfltc) @ 2007-02-16 23:15 UTC (permalink / raw)
  To: miklos; +Cc: Dave Kleikamp, akpm, linux-fsdevel, linux-kernel


>From: Miklos Szeredi <miklos@szeredi.hu>
>To: akpm@linux-foundation.org
>Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
>Subject: [PATCH] consolidate generic_writepages and mpage_writepages
>Date: 	Fri, 16 Feb 2007 17:23:25 +0100
>
>From: Miklos Szeredi <mszeredi@suse.cz>
>
>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.

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

* Re: [Fwd: [PATCH] consolidate generic_writepages and mpage_writepages]
  2007-02-16 23:15 ` [Fwd: [PATCH] consolidate generic_writepages and mpage_writepages] Steve French (smfltc)
@ 2007-02-17 10:04   ` Miklos Szeredi
  0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2007-02-17 10:04 UTC (permalink / raw)
  To: smfltc; +Cc: shaggy, akpm, linux-fsdevel, linux-kernel

> >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

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

end of thread, other threads:[~2007-02-17 10:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1171647615.8468.14.camel@kleikamp.austin.ibm.com>
2007-02-16 23:15 ` [Fwd: [PATCH] consolidate generic_writepages and mpage_writepages] Steve French (smfltc)
2007-02-17 10:04   ` Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).