> -----Original Message----- > From: Boaz Harrosh [mailto:bharrosh@xxxxxxxxxxx] > Sent: Tuesday, August 14, 2012 6:57 PM > To: Myklebust, Trond > Cc: Peng Tao; linux-nfs@xxxxxxxxxxxxxxx; Peng, Tao > Subject: Re: [PATCH-v2 2/3] NFS41: send real write size in layoutget > > On 08/14/2012 03:42 AM, Myklebust, Trond wrote: > <> > > >> void > >> pnfs_generic_pg_init_write(struct nfs_pageio_descriptor *pgio, struct nfs_page *req) > >> { > >> + u64 wb_size; > >> + unsigned policy = NFS_SERVER(pgio->pg_inode)->pnfs_curr_ld->flags & > >> + PNFS_LAYOUTGET_POLICY_MASK; > >> + > >> BUG_ON(pgio->pg_lseg != NULL); > >> > >> if (req->wb_offset != req->wb_pgbase) { > >> nfs_pageio_reset_write_mds(pgio); > >> return; > >> } > >> + > >> + if (pgio->pg_dreq == NULL) { > >> + switch(policy) { > >> + case PNFS_LAYOUTGET_ISIZE: > >> + wb_size = i_size_read(pgio->pg_inode) - req_offset(req); > >> + break; > >> + case PNFS_LAYOUTGET_SEARCH_HOLE: > >> + wb_size = pnfs_num_cont_bytes(pgio->pg_inode, req->wb_index); > >> + break; > >> + case PNFS_LAYOUTGET_ALL_FILE: > >> + wb_size = NFS4_MAX_UINT64; > >> + break; > >> + default: > >> + WARN_ONCE(1, "invalid layoutget policy %u", policy); > >> + wb_size = PAGE_CACHE_SIZE; > >> + break; > >> + } > >> + } else { > >> + wb_size = nfs_dreq_bytes_left(pgio->pg_dreq); > >> + } > >> + > > > > Please just calculate the correct value for wb_size inside > > bl_pg_init_write(), and pass it as an extra parameter to > > pnfs_generic_pg_init_write(). > > > > Then add pnfs_pg_init_object_write for objects, that calls the modified > > pnfs_generic_pg_init_write() with the PNFS_LAYOUTGET_ISIZE value. > > > > > Lets please completely kill pnfs_generic_pg_init_write() just like > files did. It gives us nothing and specialty now it is more compact > code to just inline it, like nfs4filelayout.c did. > > But please do this on top of my pending patches for 3.6-rcX. They touch > exactly this code in objects. > I have several bugfixes patches for block layout alignment that touches the same code in blocks as well. Trond, would you please merge them for one of 3.6-RCs, also the pnfs_blk_size fix and DIO fix? They are all bugfix and need to be pushed to stable. If you want, I can resend them to you. Thanks a lot. > > Files don't call this function, so adding the PNFS_LAYOUTGET_ALL_FILE > > isn't needed. > > > BTW: > filelayout_pg_init_read() > and > pnfs_generic_pg_init_read() > Is char-by-char Identical, except the very good added comment in > filelayout_pg_init_read(). Can be merged. Not exactly. For layout offset, filelayout_pg_init_read() uses 0, while generic code uses req_offset. Cheers, Tao ��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥