doubt abt a function in ext2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



/*
 * Return the offset into page `page_nr' of the last valid
 * byte in that page, plus one.
 */

static unsigned
ext2_last_byte(struct inode *inode, unsigned long page_nr)
{
        unsigned last_byte = inode->i_size;

        last_byte -= page_nr << PAGE_CACHE_SHIFT;
        if (last_byte > PAGE_CACHE_SIZE)
                last_byte = PAGE_CACHE_SIZE;
        return last_byte;
}


tht's a small function to get last byte of page number page_nr
but it seems to be wrong
as
last byte of page_nr  if byte number start with 0 for  page_nr 1

last_byte  should be = page_nr * (2^12 )

why its been subtracted from total size i_size?????

pl tell me what i am missing ?
Nidhi





--
Thanks & Regards
Nidhi Mittal Hada

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux