Add global variable of_pagesize and use it to reduce code duplication.