lkml.org 
[lkml]   [2009]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 4/8 ver5] exofs: address_space_operations
    On Tue, 31 Mar 2009 12:04:36 +0300 Boaz Harrosh <bharrosh@panasas.com> wrote:

    > >> +static int write_exec(struct page_collect *pcol)
    > >> +{
    > >> + struct exofs_i_info *oi = exofs_i(pcol->inode);
    > >> + struct osd_obj_id obj = {pcol->sbi->s_pid,
    > >> + pcol->inode->i_ino + EXOFS_OBJ_OFF};
    > >> + struct osd_request *or = NULL;
    > >> + struct page_collect *pcol_copy = NULL;
    > >> + loff_t i_start = pcol->pg_first << PAGE_CACHE_SHIFT;
    > >
    > > bug. On 32-bit this shift will overflow prior to getting promoted to
    > > 64-bit. Do:
    > >
    > > loff_t i_start = (loff_t)pcol->pg_first << PAGE_CACHE_SHIFT;
    > >
    >
    > In that case I might make pcol->pg_first loff_t.

    That would work.

    > Why is inode->i_index not an loff_t then?

    hm, what's i_index?

    > Page-index <=> byte-offset, is done all the time 12 bits does not
    > make a difference.

    Page indices are 32-bit on 32-bit CPUs. File offsets are 64-bit. We
    are careful to avoid the above overflow bug whenever the conversion
    from page index to file size is made. Try

    fgrep '(loff_t)' mm/*.c




    \
     
     \ /
      Last update: 2009-03-31 12:25    [W:0.027 / U:60.652 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site